Howdy. I''m trying to figure out how to do the route equivalent to URL- rewriting such that http://example.com/some_username is treated like a REST get on example.com/users/username (rather than id number). Suggestions? Thanks much. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On May 9, 2011, at 6:15 PM, michael_teter wrote:> Howdy. > > I''m trying to figure out how to do the route equivalent to URL- > rewriting such that http://example.com/some_username is treated like a > REST get on example.com/users/username (rather than id number). > > Suggestions?If this is the only model you ever plan to expose this way, you could try making that controller your root path, and then use FriendlyID or something else to make the connection. Walter -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I knew there was a route way to do this, and I found the simple way. The last route in my routes.rb is now this: match "*username", :to =>"site#index" And in my site controller''s index handler, I User.find_by_username(params[:username]) to know which user''s "site" I''m now a guest of. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.