Hello everyone,

I'm trying to extend the Rails Router so that if none of the routes
defined matches the current query it will call a specific method which
will return the controller and method to be called in order to serve
the request.

Now I have a few years of experience with Rails and Ruby and I've
tried looking through the code, but I've never been into the Rails
core so I'm not really sure where to look.

I'm trying to do this in Rails 3.1

Look forward to your replies.

Many Thanks,
Victor

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Philip Hallstrom at Dec 1, 2011 at 5:24 pm

    I'm trying to extend the Rails Router so that if none of the routes
    defined matches the current query it will call a specific method which
    will return the controller and method to be called in order to serve
    the request.

    Now I have a few years of experience with Rails and Ruby and I've
    tried looking through the code, but I've never been into the Rails
    core so I'm not really sure where to look.

    You shouldn't need to dig into the source... just add something like this as the *very last* route..

    match '*full_url', :controller => :foo, :action => :index

    Then make sure you've got a FooController with a #index action that can examine params[:full_url] and figure out what to do with it...

    -philip

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Victor Tanvuia at Dec 1, 2011 at 7:15 pm
    Thanks for your reply. Actually I want to go a bit deeper so that I
    can decide what to do with the path before the controller method gets
    called. In other words I need to have a method called that will
    determine which controller and action will be called.
    On Dec 1, 7:24 pm, Philip Hallstrom wrote:
    I'm trying to extend the Rails Router so that if none of the routes
    defined matches the current query it will call a specific method which
    will return the controller and method to be called in order to serve
    the request.
    Now I have a few years of experience with Rails and Ruby and I've
    tried looking through the code, but I've never been into the Rails
    core so I'm not really sure where to look.
    You shouldn't need to dig into the source... just add something like this as the *very last* route..

    match '*full_url', :controller => :foo, :action => :index

    Then make sure you've got a FooController with a #index action that can examine params[:full_url] and figure out what to do with it...

    -philip
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedDec 1, '11 at 4:52p
activeDec 1, '11 at 7:15p
posts3
users2
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2022 Grokbase