0

I have a form in a view similar to this:

<%= form_tag("mystuff/new", method: "get") do %>

    <% @accesses.each do |access| %>
        <%= radio_button_tag(:cost, access.cost) %>
        <%= label_tag  :label,access.label, :class=>"control-label" %>
        <%= label_tag :costlabel, access.cost, :class=>"control-label" %> <%= label_tag :costlabel2, "Euros", :class=>"control-label" %>
    <% end %>

    <%= submit_tag "Go" %>

<% end %>

My controller has:

    helper_method :amount

    def new
      @amount = params[:cost]
    end

and the view of mystuff/new has a line like:

    <div class="row-fluid offset1">Stuff: <%= amount -%> </div>

I get Error undefined method `amount'. What I want to do is pass the value of the radio button to the next view, but I don't want to use a database. What's the proper way to do that in rails?

4

1 回答 1

0

你在这里缺少一个@。@amount.

于 2013-09-05T17:11:08.927 回答