看不到simple_fields_for相关模型

时间:2017-06-02 12:11:49

标签: ruby-on-rails ruby ruby-on-rails-4 ruby-on-rails-5 nested-forms

Job belongs_to :order
Order has_many :jobs

Job accepts_nested_attributes_for :order

编辑备注的表单未显示。为什么呢?

<% order = @job.order %>
<%= simple_form_for @job,
  url: admin_job_path(@job),
  method: :put,
  remote: true do |f| %>
  # (...) fields for @job do show up normally
  # can't see the field below:
    <% f.simple_fields_for order do |form| %>
          <%= form.input(
            :notes,
            input_html:
              {
                value: (order.notes),
                rows: 7,
                class: 'form-control'
              }
            )
          %>
    <% end %>
  <br/>
  <%= f.button :submit, :class => "btn btn-success btn-sm" %>
<% end %>

添加一些文字,因为“它主要是代码”。我希望答案很清楚,不需要太多详细说明,但如果需要,可以随时添加更多数据。谢谢你的帮助!

1 个答案:

答案 0 :(得分:1)

  

编辑备注的表单不会显示。为什么呢?

您在= <% f.simple_fields_for order do |form| %>丢失了<%= f.simple_fields_for order do |form| %> 。它应该是

from tkinter import *
root = Tk()

root.attributes('-fullscreen', True)
root.attributes('-topmost', True)
root.overrideredirect(True)



def quitApp():
    # mlabel = Label (root, text = 'Close').pack()
    root.destroy()

# placing the button on my window
button = Button(text = 'QUIT', command = quitApp).pack()