I have:
Customer
has_many :deliveries
has_one :document
Document
belongs_to :customer
Delivery
belongs_to :customer
route.rb has:
resources :customers do
resources :deliveries
end
I already have customers in the database, I only have to add
deliveries and document to one customer.
I want to do with one single form.
Obviously this one doesn't work:
<%= form_for([@customer, @delivery]) do |f| %>
<%= f.input :delivered_at, :as => :hidden, :value => Date.today %>
<%= f.fields_for :document do |doc| %>
<%= doc.label :doc_type %>
<%= doc.text_field :doc_type %>
<%= doc.error :doc_type %>
<% end %>
<%= f.submit %>
It adds deliveries but not document.
Some advices?
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.