Do you have a before filter where you set the @user variable? It's complaining that the @user variable is nil.
On Wed, Feb 9, 2011 at 9:59 AM, jackster the jackle <[email protected]>wrote: > Since I upgraded from Rails 1.8.6 to 2.3.5, I just noticed that I can no > longer add new users through my Signup page. > Here is the error: > NoMethodError in UserController#signup > > You have a nil object when you didn't expect it! > You might have expected an instance of ActiveRecord::Base. > The error occurred while evaluating nil.save! > > /work/store/app/controllers/user_controller.rb:6:in `signup' > > Here is my Controller, line 6 is @user.save!: > def signup > return unless request.post? > @user.save! > redirect_back_or_default(:controller => 'grapher', :action => > 'index') > flash[:notice] = "New User Successfully Created" > rescue ActiveRecord::RecordInvalid > render :action => 'signup' > end > > Here is my form: > <% form_for :user do |f| -%> > <label for= "first_name">First Name</label> > <%= f.text_field :first_name %> > > <label for= "last_name">Last Name</label> > <%= f.text_field :last_name %> > > <label for= "user_login">Login</label> > <%= f.text_field :login %> > > <label for= "user_email">Email</label> > <%= f.text_field :email %> > > <label for= "user_password">Password</label> > <%= f.password_field :password %> > > <label for= "user_password_confirmation">Confirm Password</label> > <%= f.password_field :password_confirmation %> > <%= submit_tag 'Sign up' %> > <% end -%> > > Here are my request parameters when I get the error: > Request > Parameters: > > {"user"=>{"password_confirmation"=>"password", > "first_name"=>"john", > "last_name"=>"smith", > "login"=>"jsmith", > "password"=>"password", > "email"=>"[email protected]"}, > "commit"=>"Sign up"} > > It seems to me that I'm passing the correct params so I don't understand > why I'm getting a "nil object" error? > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

