ruby on rails - :id in URLs -
i'm still new ror, pardon simplicity of question...
so http://www.example.com/controller/:id displays record in table, :id being number (1,2,3 etc.).
is there way can have :id in url value of field in displayed record? such can have http://www.example.com/controller/record_field ?? want have human-friendly reference specific records in table...i'm sure must possible. change in routes.rb?
thanks help!
the cleanest way add new find method in model (or use find_by_fieldname rails gives in control). you'll have controller use method instead of regular find(params[:id]) pull model record.
check out ryan b's screencast on here. it's pretty easy, , he's teacher, shouldn't have problems.
Comments
Post a Comment