Rails link_to 和 select_tag

我正在尝试从活动页面 link_to 到带有嵌套门票表格的预订表格。我想添加一个 select_tag,以便用户可以在单击“预订门票”并加载表单之前选择他们想要的门票数量,但我找不到将 select_tag 放入 link_to 块的方法。任何帮助将非常感激。 我已经这样设置了控制器。

def create
@event = Event.find(params[:event_id])
@booking = @event.bookings.new(booking_params)
@number_of_tickets = params[:nog].to_i
@booking.user_id = current_user.id
@number_of_tickets.times { @booking.tickets.build } 

并在我看来尝试了这个

     <%= select_tag(:nog,options_for_select(1..10,selected: params[:nog]),{ prompt: 'Number of Tickets' }) %>
   <% end %>```

I just get a stringyfy keys error.

the model is set up correctly and all works when I select how many tickets in the controller and the form manually but I need the user to be able to choose how many tickets they want.

TIA
nuaadoudou 回答:Rails link_to 和 select_tag

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/61050.html

大家都在问