I have this on the view:
th = link_to "ID", :search_form => @search_form
and this on the Controller:
@search_form = params[:search_form]
On the debugger no parameter :search_form is displayed and on the program it leads to a nil error while on the controller there is an actual declared @search_form variable. Why is it empty on the Controller ?
You need to specify a path in your link_to
= link_to 'ID', some_path(search_form: @search_form)
alternatively you can specify the controller and action like this
= link_to 'ID', url_for(controller: :some_controller, action: :show, search_form: @search_form)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.