ruby - Rails error : param is missing or the value is empty: booking -
i'm building events app using rails. app offers both paid , free events. paid events i'm using stripe payment process. i'm hitting issue processing bookings free events. bookings saving none of paramaters applying themselves, hence i'm getting following error -
this simple_form free events. requires user indicate how many spaces wish reserve -
new.html.erb
<%= simple_form_for [@event, @booking], id: "new_booking" |form| %> <% if @booking.errors.any? %> <h2><%= pluralize(@booking.errors.count, "error") %> prevented booking saving:</h2> <ul> <% @booking.errors.full_messages.each |message| %> <li><%= message %></li> <% end %> </ul> <% end %> <div class="form-group"> <p>please confirm number of spaces wish reserve event.</p> <%= form.input :quantity, class: "form-control" %> </div> <p> free event. no payment required.</p> <div class="panel-footer"> <%= form.submit :submit, label: 'confirm booking', class: "btn btn-primary" %> <% end %> </div>
my bookings_controller #show action has -
def show @event = event.find(params[:event_id]) @booking = @event.bookings.new(booking_params) end
i'm trying handle logic both free , paid bookings in model,
def free_booking self.valid? if event.is_free? save! end end def paid_booking # stripe payment logic end
Comments
Post a Comment