Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8446157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:51:16+00:00 2026-06-10T09:51:16+00:00

In my rails app, I have a relation between User table (which is dedicated

  • 0

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,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T09:51:17+00:00Added an answer on June 10, 2026 at 9:51 am

    You can use fields_for:

    = f.fields_for :store do |store_field|
      = store_field.text_field :name
    

    And in your User model:

    accepts_nested_attributes_for :store
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple rails app: I have 2 models, user and intro [which is simply a
So I have a Rails app (which in this case seems like it would
In my rails app I have user, school, and course models. I have set
I have rails app which are working perfectly in the local computer. But when
I have rails app which has a list of users. I have different relations
I have the following relation in my rails app: genre - has many -
I have the following relation in my rails app: genre - has many -
In my Rails app I have a fairly standard has_many relationship between two entities.
So In my rails app I have two resources (rentals, and reservations) which belong
In my rails app,I have add a alias path at apache httpd.conf like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.