开发者

authlogic perishable token can't be null

I get this erorr eerytime I try to create a user from the console. I used to be able to do this, but ever since I turned off PT maintenance, this could have become a problem.

Thing is I do supply a value for the PT using Authlogic::Random.friendly_token, but it seems this value never shows up in the SQL statement.

What do I need to do ?

ActiveRecord::StatementInvalid: /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract_adapter.rb:219:in log': Mysql::Error: Column 'perishable_token' cannot be null: INSERT INTOusers(city,zip,created_at,single_access_token,image_file_name,voting_power,crypted_password,image_file_size,image_url,updated_at,perishable_token,username,role_id,image_content_type,lng,posts_count,failed_login_count,current_login_ip,sex,password_salt,current_login_at,persistence_token,login_count,last_login_ip,age,lat,last_login_at,image_updated_at,email,state,active,processing`) VALUES(NULL, '94131', '2010-09-07 16:26:38', '8R0L3UMxlytO2QNrXMQ', NULL, 0, '3590f21c99ecad3fa2ece943d23f55af735e9713d0d325111763b10b3e3f8a455e7ed323b6b3f5d7a721f5afc81beff5da1f2d6b20454c399751eed1623d3b7d', NULL,开发者_高级运维 NULL, '2010-09-07 16:26:38', NULL, 'asitmi', NULL, NULL, NULL, 0, 0, NULL, 1, 'mrqq5O4gFsyMcExLEOsH', NULL, 'b3ff5cd7e942212b1976f8d57941516489a0cbc4360493ff3f9b2e17e4aae48c3f53944674745ef911ca0947f62d2b5d6da10a55f7b9073f1b4c4f0b6f68b540', 0, NULL, 34, NULL, NULL, NULL, 'adfds@fddas.com', NULL, NULL, 1)

    acts_as_authentic do |a|
        a.validates_length_of_password_field_options = { :within => 1..15, :on =>:update, :if => :has_no_credential?}
        a.validates_length_of_login_field_options = { :within => 1..15, :on =>:update, :if => :has_no_credential?}
        a.account_merge_enabled true
        # set Authlogic_RPX account mapping mode
        a.account_mapping_mode :internal
        a.disable_perishable_token_maintenance = true
        a.login_field = 'username'
    end


well it this could have been a problem with mass-assignment.

If I do a

u.perishable_token = Authlogic::Random.friendly_token u.save

then it works just fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜