简体   繁体   中英

Ruby on Rails(Form submit)

I have two models User and Business. There is no association between them how can I show attributes of them in one single view with one submit.

You can create your form like this, where question_path is where you are going to post, for eg I have two models question and bug and I have defined them as such

<%= form_tag(questions_path, remote: true) do |f| %>
  <div class="field">
    <%= text_field_tag 'question[name]' %><br>
  </div>

  <div class="field">
    <%= text_field_tag 'bug[title]' %><br>
  </div>

  <div class="actions">
    <%= submit_tag %>
  </div>
<% end %>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM