Hi all - Thanks for taking a look!
Ticket: http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1115-path-to-extend-named-routes-support-for-an-objects-to_params-method Description: --------------------------------------------------------------------------------------- The title not make sense so here's a brief description. I have a route as follows: map.school '/schools/:state/:city/:id/:name' This is done for SEO purposes. Generating URLs is a pain however. Currently I need to specify every argument either in hash form or positional form. This patch extends named routing so that if my School class defined "to_params()" I can do this: school_path(@school) This assumes that I have the following method in my School model (and that I have some associations to State and City): def to_params {:state => state.full_name, :city => city.name, :id => id, :name => name.downcase} end If that method exists it will call it and continue processing the named route using the returned hash. If it does not it will continue on as normal. NOTE: This only works for named routes and only if there is a single argument to the named route. One reason this comes in really handy is when using the subdomain-fu plugin I can now specify what subdomain a model should always be linked to within the model and forget about it. --------------------------------------------------------------------------------------- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
