Alexander2016-05-18 15:35:33
Ruby on Rails
Alexander, 2016-05-18 15:35:33

2 forms of one model conflict in one layout, how to fit?

The layout has a sidebar with a quick armor form, and a separate page with a full armor form. Conflict when you go to the page of the full form, when checks on the radio buttons, the quick armor form is triggered. How to decide? Thank you!
#full form

= simple_form_for [:admin, @booked], input_html: {multipart: true} do |b|
  .input-details Выберите мобильный телефон гостя на которого будет зарезервирован столик
  = b.select :user_id, User.all.map { |u| [u.tel_number, u.id] }, { include_blank: true }, { class: 'chosen-select' }
    = b.input :table_id, as: :radio_buttons, collection: Table.all.map { |u| [u.number, u.id] }, input_html: { class: 'radio-inline__input' }, item_wrapper_class: 'col_radio', label: false

#quick booking
= simple_form_for [:admin, Booked.new], url: speed_create_booked_admin_bookeds_path do |f|
  -# [:admin, Booked.new]
  .input-details Выберите стол для быстрой брони
    = f.input :table_id, as: :radio_buttons, collection: Table.all.map { |u| [u.number, u.id] }, :disabled => ( Table.all.map { |t| [t.number, t.id] if Booked.where(table_id: t.id).where("time_finish >= ?", Time.zone.now).present? ? true : true } ), input_html: { class: 'radio-inline__input', onchange:'this.form.submit()' }, item_wrapper_class: 'col_radio', label: false

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question