You just need to send the parameters using link_to so that it is available in this method.
<%= link_to t('meters'), full_report_path(:result => 5), class: 'btn btn-sm btn-success' %>
in your method
def full
if params[:result].present?
@result = params[:result]
else
@result = 10
end
end
You can try by checking if the method is called from the link, checking if the parameters are present, if they are 5 else 10. Thats it.
http://apidock.com/rails/ActionView/Helpers/UrlHelper/link_to you can find here.
source
share