Hi Jazz,

Thank you very much for your light.
Indeed, I had in my model class a "name", but I should have "screen_name"
instead.

I got that fixed. But now I am getting this error:

NoMethodError in UserController#register

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.include?


I am cheking the presence of the fields with:

attr_accessible :screen_name, :password
validates_uniqueness_of :screen_name
validates_presence_of :screen_name, :password

Should these lines be enough to raise a message asking to fill the form
fields?

Thanks a lot!
Best Regards!

2009/5/12 Jazzmin <[email protected]>

> Hi,
>
> The error is because your table of  'User' doesn't have a 'name' field.
> Try to check your table in your database.
>
>
> On Tue, May 12, 2009 at 12:36 AM, Gustavo Senise 
> <[email protected]>wrote:
>
>> Hello folks,
>>
>> I am getting this error when using the save method:
>> NoMethodError in UserController#register
>>
>> undefined method `name' for #<User:0xb74b9198>
>>
>> RAILS_ROOT: /home/gustavo/NetBeansProjects/rails_space
>> Application Trace <http://localhost:3001/user/register#> | Framework
>> Trace <http://localhost:3001/user/register#> | Full 
>> Trace<http://localhost:3001/user/register#>
>>
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/attribute_methods.rb:260:in
>>  `method_missing'
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:397:in
>>  `send'
>>
>>
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:397:in
>>  `validates_each'
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:396:in
>>  `each'
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:396:in
>>  `validates_each'
>>
>>
>> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:182:in
>>  `call'
>> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:182:in
>>  `evaluate_method'
>> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:166:in
>>  `call'
>>
>>
>> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:90:in
>>  `run'
>> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:90:in
>>  `each'
>> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:90:in
>>  `send'
>>
>>
>> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:90:in
>>  `run'
>> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/callbacks.rb:276:in
>>  `run_callbacks'
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:1029:in
>>  `valid_without_callbacks?'
>>
>>
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/callbacks.rb:315:in
>>  `valid?'
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/validations.rb:1008:in
>>  `save_without_dirty'
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/dirty.rb:79:in
>>  `save_without_transactions'
>>
>>
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/transactions.rb:229:in
>>  `send'
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/transactions.rb:229:in
>>  `with_transaction_returning_status'
>>
>>
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in
>>  `transaction'
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/transactions.rb:182:in
>>  `transaction'
>>
>>
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/transactions.rb:228:in
>>  `with_transaction_returning_status'
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/transactions.rb:196:in
>>  `save'
>>
>>
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/transactions.rb:208:in
>>  `rollback_active_record_state!'
>> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/transactions.rb:196:in
>>  `save'
>>
>>
>> /home/gustavo/NetBeansProjects/rails_space/app/controllers/user_controller.rb:17:in
>>  `register'
>>
>>
>> The last line of the trace point to the line 17 of the user_controller,
>> that is:
>> line 15:   if request.post? and params[:user]
>> line 16:         @user = User.new(params[:user])
>> line 17:         if @user.save
>>
>> But it was working last week, and it stops now..
>> Someone would thrown some light on this so I can see whats going on?
>> Please?!
>>
>> Thanks,
>> --
>> Gustavo
>>
>> >>
>>
>


-- 
Gustavo

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "ruby-on-rails-programming-with-passion" group.
To unsubscribe from this group, send email to
ruby-on-rails-programming-with-passion-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/ruby-on-rails-programming-with-passion?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to