I have a Shop and a Document model. Shop has_many :documents and Document belongs_to :shop. I want to create a document associated to a shop. routes.rb has: resources :shops do resources :documents end 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 document creation. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.