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 575191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:54:49+00:00 2026-05-13T13:54:49+00:00

I have in a users_controller: @user = User.new(params[:user]) Passing parameters to a User model

  • 0

I have in a users_controller:

@user = User.new(params[:user])

Passing parameters to a User model which works fine.

I need to pass some additional parameters labeled “profile” to the user model through the users controller.

This didn’t work:

    @user = User.new(params[:user, :profile])

Neither did this:

    @user = User.new(params[:user], params[:profile])

I tried a variety of other similar things to get the profile parameters from the view into this model.

I’m using fields_for which works fine to get these fields into the users controller:

  <% fields_for "profile" do |fa| %>

I don’t need/want a nested relationship. I just need to simply pass some additional parameters specified in the view to the model.

Thanks!

  • 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-05-13T13:54:49+00:00Added an answer on May 13, 2026 at 1:54 pm

    fields_for is generally used for assigning params to a related model, so it makes some particular assumptions about the structure of the data.

    If you have a profile attribute in your model, you can make the profile parameter part of the params[:user] collection and this will assign the attribute correctly.

    You do this by naming the fields:

    text_field_tag(user[profile], "val") 
    
    text_field_tag(user[profile][name], "val") 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following methods in my controller: def create @user = User.new(params[:user]) if
I have a controller user with a method login For some reason, when I
I have a controller method called Edit in which the user can edit data
Inside my Controller i have function that runs after user clicks on item, which
I have a problem with passing params. in show view i have =link_to Send
I would like to access profiles table from my Profile model which belongs_to :user
My create user method in the users_controller.rb looks like: def process_login is_login_valid(params[:user][:user_name], params[:user][:password]) if
I have an User model who has_one :preference , but I would like to
Let's say I have a User model, and an Invoice model with a belongs_to
I have a comment model. I am creating a new instance of that 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.