Can't config profile page to update data forms and save

I am new to Rails and I am setting up the user profile and adding fields
it for users to add details to their profile such as career, about me,
height, religion, etc. This information is completely different from the
registration options (account settings). As of now the profile fields
being recognized as the registration fields, which is incorrect. When I
click “Update” on profile page, it redirects to registration page. So
profile page with all those fields have no value atm. The system is not
recogonizing that those values should be saved to the user profile. How
should work is when user goes to their page at /users/4 it will present
forms for all their profile details. After selecting answers for each
options, the user clicks the button “Update” and the profile information
saves. The complete opposite is happening as of now, user clicks
and it directs User back to the index (which is the register page) and
acts as if the previous page the User was on (profile page) was trying
fill out information from the registration form…which is incorrect.

Users_controller file (can also find all this information on :

class UsersController < ApplicationController



show.html file:

<%= @user.username %>


<%= form_for(@user, :url => {:action => :create}) do |f| %>

<%= f.label :height %>
<%= :about_me, [['Feet', nil], '4', '5', '6'] %> <%= :about_me, [['Inches', nil], '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'] %>
<%= f.label :children %>
<%= :children, [['Do you have or want kids?', nil], 'Yes, they live with me', 'I want kids now', 'I want one someday', 'Not for me']%>
<%= f.label :religion %>
<%= :religion, [['What is your faith?', nil], 'Agnostic', 'Atheist', 'Christian', 'Catholic', 'Buddhist', 'Hindu', 'Jewish', 'Muslim', 'Spiritual without affiliation', 'Other', 'None', 'Prefer not to say' ]%>
<%= :religion, [['How important is this to you?', nil], 'Very Important', 'Somewhat Important', 'Not Important']%>
<%= f.label :career %>
<%= f.text_field :career %>
<%= f.label :education %>
<%= :education, [['What is your education level?', nil], 'High school', 'Some college', 'Undergraduate', "Bachelor's", "Master's ", 'PhD', 'Business school', 'Law school', 'Medical school' ]%>
<%= f.label :ethnicity %>
<%= :ethnicity, [['What is your ethnicity?', nil], 'Asian', 'Black', 'Biracial', 'Indian', 'Hispanic/Latin', 'Middle Eastern', 'Native American', 'Pacific Islander', 'White', 'Other' ]%>
<%= f.label :user_drink %>
<%= :user_drink, [['How much do you drink?', nil], 'Often Drinks', 'Sometimes drinks', 'Never drinks', 'No comment' ]%>
<%= f.label :user_smoke %>
<%= :user_smoke, [['How often do you smoke?', nil], 'Often smokes', 'Sometimes smokes', 'Never smokes'] %>
<%= f.submit %>

About Me

<%= form_for @user do |f| %>
<%= f.label :about_me %>
<%= f.text_field :about_me %>
<%= f.submit %>

<% end %>
<% end %>

On 27 February 2013 16:40, C Wilson [email protected] wrote:

I am new to Rails

Have you worked right through a good Rails tutorial such as in order to understand the basics of Rails? If not
then do that first.

If you have already done that then have a look at the Rails Guide on
debugging which will show you techniques that you can use to debug
your code and work out what is going wrong. The first thing you must
do is understand why it is doing what it is doing, then you can work
out how to fix it.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs