Shop has_many :documents and Document belongs_to :shop.
I want to create a document associated to a shop.
resources :shops do
In the document form I've set:
= f.input :shop_id, :as => :hidden if @document.new_record?
I'm using simple_form.
When I submit the form the document is created but is not associated
to the shop.
It works if I do @document = Document.new(:shop_id =>
params[:shop_id]) in the new action.
Why I have to specify shop_id attribute?
shop_id is a document attribute so I think that I do not specify it on
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@example.com.
To unsubscribe from this group, send email to firstname.lastname@example.org.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.