SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Root Routing

  1. #1
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Root Routing

    Is there a way I can map the root to a certain controller so I don't have to manually enter the controller and action for each root page?

    I am using this for my root class pages:
    Code Ruby:
    map.connect 'what', :controller => 'pages', :action => 'what'
    map.connect 'faq', :controller => 'pages', :action => 'faq'
    map.connect 'about', :controller => 'pages', :action => 'about'
    map.connect 'contact', :controller => 'pages', :action => 'contact'
    Have a good day.

  2. #2
    SitePoint Enthusiast justinpalmer's Avatar
    Join Date
    Oct 2005
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you use:

    map.root

    Then that will be the root route.

    http://amrkamel.wordpress.com/2008/0...e-in-rails-20/
    Justin Palmer
    MySQL v.5

  3. #3
    SitePoint Enthusiast TomK32's Avatar
    Join Date
    Mar 2008
    Location
    Berchtesgaden, Germany
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Darren884 View Post
    Is there a way I can map the root to a certain controller so I don't have to manually enter the controller and action for each root page?
    At the very, very end of your routes.rb put this
    Code Ruby:
    map.connect ':action', :controller => 'pages'
    just a geek trying to change the world
    I'm a ruby on rails developer in Vienna, Austria. My github.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •