I have an error I don''t know how to debug. I am adding the login suport in Depot (the example in the RoR book) and LoginController#add_user throws ActiveRecord::StatementInvalid in an innocent /login/add_user GET request. The trace goes down to a call to SQLiteAdapter#table_structure, and the source code suggests what''s happening is that "PRAGMA table_structure(#{table_name})" is returning empty metadata for some reason: def table_structure(table_name) returning structure = execute("PRAGMA table_info(# {table_name})") do raise ActiveRecord::StatementInvalid if structure.empty? end end Now, the sqlite client returns this: sqlite> pragma table_info("users"); cid name type notnull dflt_value pk ---------- ---------- ---------- ---------- ---------- ---------- 0 id integer 0 1 1 name varchar(10 99 0 2 hashed_pas char(40) 0 0 And the model class is this: require ''digest/sha1'' class User < ActiveRecord::Base attr_accessor :password attr_accessible :name, :password validates_uniqueness_of :name validates_presence_of :name, :password def before_create self.hashed_password = User.hash_password(self.password) end def after_create @password = nil end private def self.hash_password(password) Digest::SHA1.hexdigest(password) end end Any hints? -- fxn PS: The full stack trace is here: http://rafb.net/paste/results/ dFbMab24.html
I have an error I don''t know how to debug. I am adding the login suport in Depot (the example in the RoR book) and LoginController#add_user throws ActiveRecord::StatementInvalid in an innocent /login/add_user GET request. The trace goes down to a call to SQLiteAdapter#table_structure, and the source code suggests what''s happening is that "PRAGMA table_structure(#{table_name})" is returning empty metadata for some reason: def table_structure(table_name) returning structure = execute("PRAGMA table_info(# {table_name})") do raise ActiveRecord::StatementInvalid if structure.empty? end end Now, the sqlite client returns this: sqlite> pragma table_info("users"); cid name type notnull dflt_value pk ---------- ---------- ---------- ---------- ---------- ---------- 0 id integer 0 1 1 name varchar(10 99 0 2 hashed_pas char(40) 0 0 And the model class is this: require ''digest/sha1'' class User < ActiveRecord::Base attr_accessor :password attr_accessible :name, :password validates_uniqueness_of :name validates_presence_of :name, :password def before_create self.hashed_password = User.hash_password(self.password) end def after_create @password = nil end private def self.hash_password(password) Digest::SHA1.hexdigest(password) end end Any hints? -- fxn PS: The full stack trace is here: http://rafb.net/paste/results/ dFbMab24.html