Reputation: 23
I'm new to ruby on rails and have been playing with some open source code in order to learn.
I am having some issues understanding what the model_path(@model)
method returns and how to change it. Specifically, I have a model with an id
and a slug
and for some reason model_path(@model)
always returns the path with the slug
and not the id
.
Any ideas on why this may be and how I can change this behavior?
Upvotes: 2
Views: 2998
Reputation: 3236
model_path(@model)
will produce this URL
/model/:id
it will substitute :id
with whatever @model.to_param
returns
Upvotes: 1