Hi, I have a form that submits values from text fields and a check box.
The values posted are: camp location name, number of nights, number of
parents, number of children, value from the check box “family claim”.
Where camp name can’t be nil, nights can’t be more than 2, parents and
children together can’t be more than 8 and if there are no children
specified check box can’t be checked. Here’s my unsuccessful
implementation for this:
camp_loc = params[:camp][:id]
if camp_loc.blank? || nights.blank? || parents.blank?
redirect_to_booking(“Fields with ‘*’ are required fields.”)
elsif (nights.to_i > 2) || ((parents.to_i + children.to_i) > 8)
redirect_to_booking(“Limitation: Maximum stay of 2 nights with group
of maximum 8 people.”)
elsif children.nil? and family_rate_claim == “1”
redirect_to_booking(“You are not eligible for claiming family
…add the stuff in the cart
render :action => :online_booking
When I click the button without giving anything as the input I get this:
Render and/or redirect were called multiple times in this action. Please
note that you may only call render OR redirect, and at most once per
action. Also note that neither redirect nor render terminate execution
of the action, so if you want to exit an action after redirecting, you
need to do something like “redirect_to(…) and return”.
but what I want is to to get redirected to the same page with error