I’m having a really hard time trying to get a specific form in RoR to
work. I’m trying to build a really simple page which lets the user make
a pizza by setting check boxes. The choose their toppings, click submit
and the form does a callback and shows them how much it will cost to
have a pizza with those toppings on.
At the moment I have the following:
<%= start_form_tag :action => “pick_your_own” %>
<%= check_box “pizza”, “anchovies” %>
<% end_form_tag %>
@total = 0
if @pizza.anchovies? > 0 then
@total = @total + 10
This gives me a NoMethodError with “You have a nil object when ou didn’t
expect it. This error occured when evaluating nil.anchovies?”
Also note, I’m not trying to enter this into a database, I’m just trying
to tell the user how much this will cost. I’ve been trawling with google
for hours. I can’t seem to find any answers that work.
Any help with this would be great! Thanks.