In my rails app, I have a relation between User table (which is dedicated to authentication purpose) and Store table (which contains store information, like the name, description,...).
I mapped the two models like this:
User has_one :store
Store belongs_to :user
In the registration phase, I need to ask for both authentication information (I'm using Devise gem) like email and password, and the store name. This mean that I would like to fill two connected tables (User and Store) using the same form!
How does the ERB (or Haml) form looks like, especially for the Store Name part?
I tried this, but it doesn't work (more specifically, the line asking for store name):
= form_for(resources, :as => resource_name, :url => registration_path(resource_name)) do |f|
= f.text_field :store[:name]
= f.email_field :email
= f.password_field :password
= f.submit "Create"
Thanks in advance,