Forum: Ruby on Rails Help. Acts_as_Authenticated plugin stops working for me?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mister Yu (Guest)
on 2007-07-18 05:49
(Received via mailing list)
Hi,

I successfully installed AAA couple days before, and i managed to
register a uer with it, with no user activation.

but for some strange reason, it stops working for the signup method,
with i go to the signup page, press submit, it shows an error page,
what's wrong? here's the error page.


undefined method `activation_code' for #<User:0x3b6dbd
@errors=#<ActiveRecord::Errors:0x1a1a1c6 @errors={}, @base=#<User:
0x3b6dbd ...>>,
@attributes={"salt"=>"d580c223adee13c8723434e3987a0787ad124e5b",
"updated_at"=>Wed Jul 18 02:47:19 BST 2007,
"remember_token_expires_at"=>nil,
"crypted_password"=>"78dfec22ed3e7418647c7e90e22d0e4e93c5f375",
"id"=>6, "remember_token"=>nil, "email"=>"removed_email_address@domain.invalid",
"login"=>"erv2", "created_at"=>Wed Jul 18 02:47:19 BST 2007},
@new_record=false, @password="000000",
@password_confirmation="000000">:User

RAILS_ROOT: script/../config/..
Application Trace | Framework Trace | Full Trace

C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/activerecord-1.15.3/lib/active_record/transactions.rb:101:in
`transaction'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/activerecord-1.15.3/lib/active_record/transactions.rb:121:in
`transaction'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/activerecord-1.15.3/lib/active_record/transactions.rb:133:in
`save_with_transactions!'
app/controllers/account_controller.rb:28:in `signup'

C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/activerecord-1.15.3/lib/active_record/transactions.rb:101:in
`transaction'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/activerecord-1.15.3/lib/active_record/transactions.rb:121:in
`transaction'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/activerecord-1.15.3/lib/active_record/transactions.rb:133:in
`save_with_transactions!'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/base.rb:1095:in `send'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/base.rb:1095:in
`perform_action'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/filters.rb:631:in
`call_filter'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/filters.rb:619:in
`perform_action_with_filters'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:65:in
`perform_action_with_benchmark'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/rescue.rb:83:in `measure'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:66:in
`perform_action_with_benchmark'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/rescue.rb:83:in
`perform_action_with_rescue'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/base.rb:431:in `send'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/base.rb:431:in `process'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/filters.rb:624:in
`process_with_filters'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/session_management.rb:
114:in `process_with_session_management_support'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/base.rb:330:in `process'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/rails-1.2.3/lib/dispatcher.rb:41:in `dispatch'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/rails-1.2.3/lib/webrick_server.rb:118:in `handle_dispatch'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/rails-1.2.3/lib/webrick_server.rb:81:in `service'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/1.8/webrick/
httpserver.rb:104:in `service'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/1.8/webrick/
httpserver.rb:65:in `run'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/1.8/webrick/
server.rb:173:in `start_thread'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/1.8/webrick/
server.rb:95:in `start'

C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/activerecord-1.15.3/lib/active_record/transactions.rb:101:in
`transaction'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/activerecord-1.15.3/lib/active_record/transactions.rb:121:in
`transaction'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/activerecord-1.15.3/lib/active_record/transactions.rb:133:in
`save_with_transactions!'
app/controllers/account_controller.rb:28:in `signup'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/base.rb:1095:in `send'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/base.rb:1095:in
`perform_action'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/filters.rb:631:in
`call_filter'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/filters.rb:619:in
`perform_action_with_filters'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:65:in
`perform_action_with_benchmark'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/rescue.rb:83:in `measure'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:66:in
`perform_action_with_benchmark'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/rescue.rb:83:in
`perform_action_with_rescue'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/base.rb:431:in `send'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/base.rb:431:in `process'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/filters.rb:624:in
`process_with_filters'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/session_management.rb:
114:in `process_with_session_management_support'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/actionpack-1.13.3/lib/action_controller/base.rb:330:in `process'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/rails-1.2.3/lib/dispatcher.rb:41:in `dispatch'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/rails-1.2.3/lib/webrick_server.rb:118:in `handle_dispatch'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/gems/1.8/
gems/rails-1.2.3/lib/webrick_server.rb:81:in `service'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/1.8/webrick/
httpserver.rb:104:in `service'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/1.8/webrick/
httpserver.rb:65:in `run'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/1.8/webrick/
server.rb:173:in `start_thread'
C:/Program Files/NetBeans 6.0M10/ruby1/jruby-1.0/lib/ruby/1.8/webrick/
server.rb:95:in `start'
Jodi S. (Guest)
on 2007-07-18 05:59
(Received via mailing list)
On 17-Jul-07, at 9:48 PM, Mister Yu wrote:

>
> undefined method `activation_code' for #<User:0x3b6dbd

Looks like you didn't run the required migration - or backed it out.

AAA requires a few fields - the error above means it's looking for
one that isn't there.

Jodi
Mister Yu (Guest)
on 2007-07-18 14:18
(Received via mailing list)
Hi Jodi,

Thanks for the reply. I thought of that as well, but when i look at
the Database Migrations->migrate->006_create_users.rb, that field
isn't there.

did i skip some steps when i installed it? but it worked for me
before.

here is the file:

class CreateUsers < ActiveRecord::Migration
  def self.up
    create_table "users", :force => true do |t|
      t.column :login,                     :string
      t.column :email,                     :string
      t.column :crypted_password,          :string, :limit => 40
      t.column :salt,                      :string, :limit => 40
      t.column :created_at,                :datetime
      t.column :updated_at,                :datetime
      t.column :remember_token,            :string
      t.column :remember_token_expires_at, :datetime
    end
  end

  def self.down
    drop_table "users"
  end
end
Mikel (Guest)
on 2007-07-27 10:57
(Received via mailing list)
I am not sure why this happens, I had the same problem.

Simple fix is to make a new migration:

call it add_activation_code and put the following in it.

class AddActivationCode < ActiveRecord::Migration
  def self.up
    add_column :users, :activation_code, :string
  end

  def self.down
    remove_column :users, :activation_code
  end
end

Then migrate and you should be OK

Regards

Mikel
http://www.blognow.com.au/q
This topic is locked and can not be replied to.