简体   繁体   English

Rails-通过link_to传递参数

[英]Rails - Passing Parameters through link_to

I want to create an Add to Watchlist column + link after the description field ,so the selected movie to be stored on another rb. 我想在description字段后创建一个Add to Watchlist列+链接,以便将选定的电影存储在另一个rb上。 page from the admin section called "Watchlist". 管理部分中的“监视列表”页面。

The concept is similar to a Shopping Cart,passing the data from one page to another. 这个概念类似于购物车,将数据从一页传递到另一页。

How's that possible in ActiveAdmin? 在ActiveAdmin中怎么可能?

I would appreciate your hints and advices. 非常感谢您的提示和建议。

这一页

I'm not familiar with ActiveAdmin, but if your question is how to pass parameters through link_to, try this: 我对ActiveAdmin不熟悉,但是如果您的问题是如何通过link_to传递参数,请尝试以下操作:

link_to 'Somewhere', some_path(param_1: 'foo', param_2: 'bar')

When you click through, the params should be present in the query string and in the params hash that Rails provides. 单击时,参数应该出现在查询字符串和Rails提供的参数哈希中。 You can pull out the values with: 您可以使用以下方法提取值:

params[:param_1]
params[:param_2]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM