Skip to content

Instantly share code, notes, and snippets.

@rmatuoka
Created April 27, 2015 17:23
Show Gist options
  • Save rmatuoka/dd6904809cf89cf916f7 to your computer and use it in GitHub Desktop.
Save rmatuoka/dd6904809cf89cf916f7 to your computer and use it in GitHub Desktop.
passing params from A view to Bs_controller
<div>
<%if current_user%>
<%=form_for(ModelB.new) do |f|%>
<%if (params[:param_to_check].present?)%>
<%f.hidden_field "param1",:value=> @modelA.id%>
<%f.hidden_field "param2",:value=> current_user.id%>
<%end%>
render button
<%end%>
<%else%>
render other butotn
<%end%>
@modelA=ModelA.find_by_id(params[:param1])
:option_from_specific_gem=> -(@modelA.wanted_value).abs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment