Diego Carrion
2010-Apr-18 00:03 UTC
Add shorthand support for routes like /projects/status(.:format)
Hi, when trying to migrate Signal to Rails 3 I tried to use the shorthand route for: match ''/projects/status(.:format)'' but it thrown an error because the controller was not specified. This happend because actually the shorthand routes only work with routes without optional parameters. The modification to support routes ending with a optional parameters is very simple, as can be seen here: https://rails.lighthouseapp.com/projects/8994/tickets/4423-patch-add-shorthand-support-for-routes-like-projectsstatusformat <https://rails.lighthouseapp.com/projects/8994/tickets/4423-patch-add-shorthand-support-for-routes-like-projectsstatusformat>This way, we can create a route like the specified instead of: match ''/projects/status(.:format)'' => "projects#status", :as => :project_status -- Diego Carrion http://www.diegocarrion.com http://www.mouseoverstudio.com/blog/ http://www.twitter.com/dcrec1 http://www.workingwithrails.com/person/13580-diego-carrion -- 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 rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Jeremy Kemper
2010-Apr-18 00:53 UTC
Re: Add shorthand support for routes like /projects/status(.:format)
On Sat, Apr 17, 2010 at 5:03 PM, Diego Carrion <dc.rec1@gmail.com> wrote:> Hi, when trying to migrate Signal to Rails 3 I tried to use the shorthand > route for: > match ''/projects/status(.:format)'' > but it thrown an error because the controller was not specified. This > happend because actually the shorthand routes only work with routes without > optional parameters. The modification to support routes ending with a > optional parameters is very simple, as can be seen here: > https://rails.lighthouseapp.com/projects/8994/tickets/4423-patch-add-shorthand-support-for-routes-like-projectsstatusformat > This way, we can create a route like the specified instead of: > match ''/projects/status(.:format)'' => "projects#status", :as => > :project_statusApplied. Thanks Diego! jeremy -- 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 rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.