<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>Recent Posts in 'Routing issues' | Pragmatic Forums</title>
    <link>https://forums.pragprog.com/forums/22/topics/231</link>
    <language>en-us</language>
    <ttl>60</ttl>
    <description></description>
    <item>
      <title>Routing issues posted by Timothy Knight @ Thu, 06 Mar 2008 03:39:21 -0000</title>
      <description>&lt;p&gt;Awesome Don, glad it helped.&lt;/p&gt;</description>
      <pubDate>Thu, 06 Mar 2008 03:39:21 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:22:231:2386</guid>
      <author>Timothy Knight</author>
      <link>https://forums.pragprog.com/forums/22/topics/231</link>
    </item>
    <item>
      <title>Routing issues posted by Don Bessinger @ Sat, 01 Mar 2008 19:00:17 -0000</title>
      <description>&lt;p&gt;Bingo.  My error was including the slash character in &lt;tt&gt;map.connect&lt;/tt&gt;&amp;#8217;s &lt;tt&gt;path&lt;/tt&gt; parameter.  Lesson learned, and thanks again, Tim.&lt;/p&gt;


	&lt;p&gt;Don Bessinger&lt;/p&gt;</description>
      <pubDate>Sat, 01 Mar 2008 19:00:17 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:22:231:2355</guid>
      <author>Don Bessinger</author>
      <link>https://forums.pragprog.com/forums/22/topics/231</link>
    </item>
    <item>
      <title>Routing issues posted by Don Bessinger @ Sat, 01 Mar 2008 17:06:20 -0000</title>
      <description>&lt;p&gt;Thanks, Tim!  Actually, I haven&amp;#8217;t solved the problem.  Instead, I just used regular &lt;span class="caps"&gt;HTML&lt;/span&gt; redirects to show the usual &amp;#8220;This page has moved.  If you are not redirected&amp;#8230;&amp;#8221; message.  I&amp;#8217;ll give this a try as soon as I figure out the answer (or workaround!) to my current problem.  Thanks again.&lt;/p&gt;


	&lt;p&gt;Don Bessinger&lt;/p&gt;</description>
      <pubDate>Sat, 01 Mar 2008 17:06:20 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:22:231:2354</guid>
      <author>Don Bessinger</author>
      <link>https://forums.pragprog.com/forums/22/topics/231</link>
    </item>
    <item>
      <title>Routing issues posted by Timothy Knight @ Fri, 29 Feb 2008 02:32:10 -0000</title>
      <description>&lt;p&gt;Hey Don, I don&amp;#8217;t know if I&amp;#8217;m over simplifying your question&amp;#8230; and perhaps after a month you have already found an adequate solution, but&amp;#8230;&lt;/p&gt;


	&lt;p&gt;Perhaps have a main page in which my typical root route might look like:&lt;/p&gt;


	&lt;p&gt;&lt;code&gt;map.connect '', :controller =&amp;gt; "welcome"&lt;/code&gt;&lt;/p&gt;


	&lt;p&gt;And in the index definition of the welcome controller I would first check to see if the user is logged in &amp;#8211; if not, the send them to the user controller login action.&lt;/p&gt;


	&lt;p&gt;Also, be sure that you have removed the index.html file from the public folder.  If this file is found the dispatcher won&amp;#8217;t go looking into the controllers for anything it will stop at the index.html file and render that.&lt;/p&gt;


	&lt;p&gt;Tim Knight&lt;/p&gt;</description>
      <pubDate>Fri, 29 Feb 2008 02:32:10 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:22:231:2347</guid>
      <author>Timothy Knight</author>
      <link>https://forums.pragprog.com/forums/22/topics/231</link>
    </item>
    <item>
      <title>Routing issues posted by Don Bessinger @ Thu, 24 Jan 2008 20:01:32 -0000</title>
      <description>&lt;p&gt;OK, I&amp;#8217;ve answered part of my own question, anyway.  If my suspicions are correct, this line:&lt;/p&gt;


&lt;pre&gt;map.connect '/', :controller =&amp;gt; 'user', :action = 'login'&lt;/pre&gt;

	&lt;p&gt;is the opposite of what I want to do.  I&amp;#8217;ve apparently made sure that, when a user hits &lt;tt&gt;&lt;a href="http://localhost:3000/user/login"&gt;http://localhost:3000/user/login&lt;/a&gt;&lt;/tt&gt;, he is promptly routed to &lt;tt&gt;&lt;a href="http://localhost:3000/"&gt;http://localhost:3000/&lt;/a&gt;&lt;/tt&gt; &amp;#8211; certainly not the intended result.&lt;/p&gt;


	&lt;p&gt;Still not sure how to get an &lt;span class="caps"&gt;RHTML&lt;/span&gt; index page up and running, though, so if anyone has any thoughts, I&amp;#8217;m all ears.&lt;/p&gt;


	&lt;p&gt;Don Bessinger&lt;/p&gt;</description>
      <pubDate>Thu, 24 Jan 2008 20:01:32 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:22:231:2220</guid>
      <author>Don Bessinger</author>
      <link>https://forums.pragprog.com/forums/22/topics/231</link>
    </item>
    <item>
      <title>Routing issues posted by Don Bessinger @ Mon, 21 Jan 2008 16:10:13 -0000</title>
      <description>&lt;p&gt;Hello,&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve been messing around with routing, particularly defining routes with &lt;tt&gt;map.connect&lt;/tt&gt;.  Rails spits out a generic home page for an application, found in &lt;tt&gt;/public.index.html&lt;/tt&gt;.  I&amp;#8217;d like to use routing to set my application&amp;#8217;s home page to a login page.  Here&amp;#8217;s what I&amp;#8217;ve done:&lt;/p&gt;


	&lt;p&gt;1.  I&amp;#8217;ve added this line to the application&amp;#8217;s &lt;tt&gt;config/routes.rb&lt;/tt&gt; file.  It is the first line after the &lt;span class="caps"&gt;WSDL&lt;/span&gt; line (right after the Rails-generated &lt;tt&gt;# Install the default route as the lowest priority.&lt;/tt&gt; comment), so the file looks like this:&lt;/p&gt;


&lt;pre&gt;
ActionController::Routing::Routes.draw do |map|

  # [bunch of comments here]
  ...

  # Allow downloading Web Service WSDL as a file with an extension
  # instead of a file named 'wsdl'
  map.connect ':controller/service.wsdl', :action =&amp;gt; 'wsdl' 

  # Install the default route as the lowest priority.
  map.connect '/', :controller =&amp;gt; 'user', :action =&amp;gt; 'login'
  map.connect ':controller/:action/:id.:format'
  map.connect ':controller/:action/:id'
end
&lt;/pre&gt;

	&lt;p&gt;2.  Invoked &lt;tt&gt;script/console&lt;/tt&gt; and made sure the updated routes were loaded by entering this command:&lt;/p&gt;


&lt;pre&gt;
&amp;gt;&amp;gt; load "config/routes.rb" 
=&amp;gt; []
&amp;gt;&amp;gt;
&lt;/pre&gt;

	&lt;p&gt;3.  Tested my new and improved routing by doing this at the console:&lt;/p&gt;


&lt;pre&gt;
&amp;gt;&amp;gt; rs = ActionController::Routing::Routes
=&amp;gt; #&amp;lt;ActionController::Routing::Routset:0x2....[the expected mountain of output here]
&amp;gt;&amp;gt; rs.recognize_path '/'
=&amp;gt; {:action=&amp;gt;"login", :controller=&amp;gt;"user"}
&amp;gt;&amp;gt;
&lt;/pre&gt;

	&lt;p&gt;OK, I&amp;#8217;m satisfied with that.  However, when I fire up my browser (Firefox 2) and hit &lt;tt&gt;&lt;a href="http://localhost:3000/"&gt;http://localhost:3000/&lt;/a&gt;&lt;/tt&gt;, I still get the Rails-generated &lt;tt&gt;public/index.html&lt;/tt&gt; page.  I&amp;#8217;ve tried closing all browser instances, stopping and restarting the WEBrick server, and then hitting the site, but meet with the same result.  Anybody have any thoughts on what gives?  I&amp;#8217;ve also tried deleting my new line and adding default controller and action values to the entries that Rails generated, but that didn&amp;#8217;t work either (in fact, it generated warnings when I reloaded the &lt;tt&gt;config/routes.rb&lt;/tt&gt; from the console).  Thanks!&lt;/p&gt;


	&lt;p&gt;Don Bessinger&lt;/p&gt;</description>
      <pubDate>Mon, 21 Jan 2008 16:10:13 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:22:231:2201</guid>
      <author>Don Bessinger</author>
      <link>https://forums.pragprog.com/forums/22/topics/231</link>
    </item>
  </channel>
</rss>
