Is it possible to make partial use of a helper method in which you can also pass local variables from the view in which the helper method is called? For example, when I include this code directly in the view, it does partial correctly:
<%= render :partial => "add_round", :locals => { :f => f } %>
Then I translated it into a helper method:
def addRound render :partial => "add_round", :locals => { :f => f } end
Then I called it again from the view:
<%= addRound %>
This did not work with: locals => {: f => f} included in the code. He returned this error: undefined local variable or `f 'method. However, the addRound method did something with the following:
def addRound render :partial => "add_round" end
Writing this method allowed me to display partial ones that did not require the transfer of local variables (for example, simple text strings). But how can I make it work with: locals => {: f => f} enabled? Is there any other way to write this?
Many thanks.
Josh
source share