[Rails] How to use custom url formats?

Sebastian Gräßl sebastian.graessl at gmail.com
Wed Jan 11 05:38:50 GMT 2006


Rails searches for an Record in the db with ID = "honda"... got it?


Am 11.01.2006 um 05:27 schrieb Mike Schinkel:

> I'm new to Rails and am trying to use a field called "code" instead of
> "id" in my URLs.  For example, assuming I've got a database of
> motorcycles makes where the codes are "Honda", "Yamaha", "Suzuki", and
> "Kawasaki", etc.  To show the info about Honda I want to use this url:
>
>    http://www.mysite.com/makes/honda/
>
> instead of:
>
>    http://www.mysite.com/makes/show/1/
>
> I have a controller called makes_controller.rb, a model called  
> make.rb,
> and a layout called makes.rhtml.  What would I need to modify?  And if
> you don't mind, could you be specific about where the changes go since
> I'm new to rails.
>
> Mucho thanks in advance.
>
> -- 
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails



More information about the Rails mailing list