开发者

How does the model_path() method work

开发者 https://www.devze.com 2023-02-06 16:02 出处:网络
I\'m new to ruby on rails and have been playing with some open source code in order to lear开发者_开发问答n.

I'm new to ruby on rails and have been playing with some open source code in order to lear开发者_开发问答n.

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?


model_path(@model) 

will produce this URL

/model/:id

it will substitute :id with whatever @model.to_param returns

0

精彩评论

暂无评论...
验证码 换一张
取 消