Ruby on Rails
Wednesday, August 31, 2011
On Wed, Aug 31, 2011 at 10:51 PM, 7stud -- <lists@ruby-forum.com> wrote:
Conrad Taylor wrote in post #1019393:
> Bruno, I would recommend reading section 4.2 of the Rails routing guide:I read that, and I don't see how applying a regex to the id will help.
>
How about adding :show to the :except clause and doing this:
match '/:id' => 'users/show'
having this line will match any controller's index action so i think that's not fine
unless you place this at the bottom of your routes file.
resources :users, :except=>[:destroy, :show]
in the Segments Constraints section of the rails guide, you'll see the first line of code.
following that code, you can use
match
'users/:id'
=>
'users#show'
,
:constraints
=> {
:id
=> /
\d
/ }, :via => :get
the via option is important so that it will only match get requests.
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.
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com
--
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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment