What you want to do p>
I want to pass the value when linking to the controller from the view side p>
Add it in the form of a hash to the argument of the path as shown below p>
* Example) When passing a value from top / index to top / link1 p>
erb:top/index.html.erb
<%= link_to "To link 1", top_link1_path(name: "piyo") %>
Receive parameters p>
top_controller
class TopController < ApplicationController
def link1
@params = params[:name]
end
end
I searched a lot, but as a memorandum p>
Recommended Posts