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
to
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
are
being recognized as the registration fields, which is incorrect. When I
click “Update” on profile page, it redirects to registration page. So
the
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
it
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
“Update”
and it directs User back to the index (which is the register page) and
it
acts as if the previous page the User was on (profile page) was trying
to
fill out information from the registration form…which is incorrect.

Users_controller file (can also find all this information on
https://gist.github.com/pwz2k/5047974) :

class UsersController < ApplicationController

else

end

show.html file:

<%= @user.username %>

Basics

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

<%= f.label :height %>
<%= f.select :about_me, [['Feet', nil], '4', '5', '6'] %> <%= f.select :about_me, [['Inches', nil], '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'] %>
<%= f.label :children %>
<%= f.select :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 %>
<%= f.select :religion, [['What is your faith?', nil], 'Agnostic', 'Atheist', 'Christian', 'Catholic', 'Buddhist', 'Hindu', 'Jewish', 'Muslim', 'Spiritual without affiliation', 'Other', 'None', 'Prefer not to say' ]%>
<%= f.select :religion, [['How important is this to you?', nil], 'Very Important', 'Somewhat Important', 'Not Important']%>
<%= f.label :career %>
<%= f.text_field :career %>
<%= f.label :education %>
<%= f.select :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 %>
<%= f.select :ethnicity, [['What is your ethnicity?', nil], 'Asian', 'Black', 'Biracial', 'Indian', 'Hispanic/Latin', 'Middle Eastern', 'Native American', 'Pacific Islander', 'White', 'Other' ]%>
<%= f.label :user_drink %>
<%= f.select :user_drink, [['How much do you drink?', nil], 'Often Drinks', 'Sometimes drinks', 'Never drinks', 'No comment' ]%>
<%= f.label :user_smoke %>
<%= f.select :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
railstutorial.org 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.

Colin

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