开发者

link_to param scoping in rails?

I have a page which has a couple option links that set GET-based parameters to the page.

These links are created with the Rails HtmlHelper:

link_to section, {:company_id => params[:company_id], :view => section}

Notice how I have to retype out parameters just in case they've been selected before.

I want to know if I can achieve 开发者_StackOverflow中文版this same effect, to automatically account for all parameters so it's just easier to write and read.


You could try something like

link_to section, params.merge({ :view => section })
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜