ruby on rails - Pass data between two controllers but not via url as params -
below code
<% if @user.empty? == true %> <p> sorry no data display</p> <%else%> <% @user.each |n|%> user id = <%=n.id%> <br \> user type = <%=n.type%> <br \> user name = <%= n.name%> <br \> <%= link_to "good. can proceed on creating new", new_user_product_path(current_user)%> <%end%> <%end%>
this code under searches#index
. can see, after set of results shown, want user able create new product. when creating product, want make sure <%= n.name%>
pass on new_user_product_path(current_user)
(its form). not via url.
the form field want populate is
<%= f.hidden_field :user_name%>
so, how do it?
thanks
i think found solution
i made <%=n.name%>
<% $name = n.name %>
, since global variable, accessible now.
Comments
Post a Comment