【发布时间】:2017-03-07 17:27:21
【问题描述】:
我已经根据哈希中的条件检索了一些记录 - @special_products。现在我想将哈希传递给同一个控制器的非静态操作(:特殊)/,以便我可以查看产品。
我已经尝试过了,但是如何通过 link_to 传递哈希以及如何在同一 products_controller 中的action: special? 中检索该值?非常感谢。
products_controller.rb
def show
@special_products = Product.by_company
end
show.html.erb
<%= link_to "Special Products", special_path(:anchor => "#{@special_products}") %>
【问题讨论】:
标签: ruby-on-rails link-to