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

  • Home
  • SEARCH
  • 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 8385179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:36:18+00:00 2026-06-09T17:36:18+00:00

How to construct a model in rails 3 user having one profile. user having

  • 0

How to construct a model in rails 3

  1. user having one profile.

  2. user having one notification

  3. user having one role such as admin etc.

I want to make their relation ship.
After making it.

How to use one form to insert data into all these tables at a time.

Any help will be appriciated..
Thank you

  • 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-09T17:36:20+00:00Added an answer on June 9, 2026 at 5:36 pm

    search http://guides.rubyonrails.org/association_basics.html to better understand rails associations.

    user.rb

    has_one :profile
    has_one :notification
    has_one :role
    
    accepts_nested_attributes_for :profile, :notification, :role
    

    You might to put each of the “accepts nested attributes for” on their own line.

    The each other model would need:

    belongs_to :user

    EDIT

    form

    = form_for @user do |f|
    
     .field
       f.text_field :name
    
     .field
       f.text_field :email
    
     f.fields_for :profile do |t|
       .field
         t.text_field :description
    
     .actions
       = f.submit
    

    Also, in your controller, make sure to have:

    def new
     @user = User.new(profile: Profile.new)
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to construct model with properties in form of lists. class Data(db.Model): listOfIntergers
Hey guys, I'm having trouble understanding a Rails construct. I'm using Rails 3 but
Am trying to construct a simple update query in my model class Model_DbTable_Account extends
Here's a snippet from my application: class PortolioItem(models.Model): ... user = models.ForeignKey(User) contract =
I have a basic Rails model with two properties, name and code . I
I have two models in a has_many relationship such that Log has_many Items. Rails
I am writing an admin check to make sure that the email that is
I have a Listing model in my rails app. I have atable with all
In a Rails model I have an attribute is_subscriber , when I constructed a
I'm using Rails 3.2.3 with the money-rails gem and I've got a product model

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.