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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:58:54+00:00 2026-06-16T13:58:54+00:00

I have a form that needs to update a user objects attributes. Here are

  • 0

I have a form that needs to update a user objects attributes.

Here are the three steps that I’ve boiled down to:

  1. the action ‘new’ needs to provide the form with an object to manipulate

  2. The form needs to know which object to collect values for

  3. when the form is submitted it needs to send these params to a function that updates the user object

If all this is kosher here’s what I’ve done to try and make this happen.

Within the ‘new’ action I’ve attempted to provide the user object like so:

      @current_user  = current_user

Then, in the view this is what the form looks like:

<%= form_for (@current_user) do |f| %>
   <%= f.label :target_bf_pct %>
   <%= f.text_field :target_bf_pct %>

   <%= f.label :activity_factor %>
   <%= options_for_select([['Sedentary (Desk Job)', 1.2],
                                           ['Light Activity (1-3 day a week)', 1.35],
                                           ['Moderate Activity (3-5 days a week)', 1.55],
                                           ['Very Active ( 6-7 days a week)', 1.75],
                                           ['Extremely Active (Atheletic Endurance)', 1.95]])
%>

  <%# f.submit "Post", class:"btn btn-large btn-primary" %> 
<% end %> 

The error I’m getting at this point is this:

undefined method `user_path' for #<#<Class:0x007fd943d00d08>:0x007fd944e5b6c0>

which is referring to the forms @current_user object that’s supposed to correspond to the @current_user instance within the new action…

Important note:

  1. I’m using devise for my sessions controller to create new users and handle sessions.

  2. I don’t believe that my use of the form helper options_for_select is being used properly since I’ve yet to assign it a value it’s supposed to represent once selected like "activity_factor"

  • 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-16T13:58:55+00:00Added an answer on June 16, 2026 at 1:58 pm
    <%= form_for(@current_user) do |f| %>
                ^ no space please :)
    

    This is not a joke.

    <%= form_for (@current_user) do |f| %>
    

    will work, but, for example:

    <%= form_for (@current_user, :class => "user_form") do |f| %>
    

    will not. With space you’re on the way to do mistakes like that.

    The second one. Your environment doesn’t know user_path

    Add to routes.rb (even if devise’s statements exist):

    resources :users
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that needs to go to different owners depending on the
I have a Django form that needs to do some client-side validation before submitting
I have an HTML form that needs multiple submit buttons, like this: <input type=submit
I have a C# form that has a text box that needs to constantly
I have a page with a form on it that needs to post to
I have a win form that creates a site in IIS7. One function needs
I have a form that asks the user to enter their Google Analytics code
So I have an input form that I want to use to update a
I have an html/php form that updates entries on the database server. I need
I have a hidden button on a form that I need to click in

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.