I cannot explain why, but somehow my form_tag form is skipping streight to my view and completely bypassing my controller action.
This is my form_tag:
<%=form_tag url_for(:controller=>"orders", :action=>"finalize_order"), :method=>'post' do%>
<%=hidden_field_tag "cc_id_selection"%>
<%=hidden_field_tag "address_id_selection"%>
<%=submit_tag "Checkout", :class=>"btn btn-primary"%>
<%end%>
And here is my controller action:
def finalize_order
@selected_user_card_id = UserCard.find(params[:cc_id_selection])
begin #in case they chose pickup
@selected_address = Address.find(params[:address_id_selection])
rescue
@selected_address = params[:address_id_selection] #we can add options besides pickup if we'd like
end
end
This is what is logged in my console (with some ip stuff taken out) I tried putting a trace in the controller and don't see any sign of it:
Started POST "/finalize_order" Processing by OrdersController#finalize_order as HTML
I see at the bottom of the error page that the two params were successfully posted. Yet when I submit I get error in the next view indicating no param was instantiated in the controller. Even stranger, when I comment out the action I get the same exact results! I even tried using a route, anf get the same results. It seems I am completely skipping the action and going streight to the view. What might cause this bug?
putsstatements in that method? - Arslan Alicc_id_selectionandaddress_id_select. - Arslan Ali