Skip to content Skip to sidebar Skip to footer

Rails 3 And Sqlite Communications Concerning Boolians

im using Rails 3.2.8 and SQLite 1.3.6 and im running into troubles changing boolian variables in the database SQLite translates 't' and 'f' as true and false this function wont upd

Solution 1:

If the approved column on @user is a boolean, you should just pass true/false and let the database adaptor figure it out.

@user.update_attribute(:approved, true)

Solution 2:

I solved this by using a integer migration to my users table, i have no idea as of why @user.update_attribute(:approved, true) didnt save to the database it must have had something to do with my setup

i made the migration add_column :users, :is_approved, :integer, :default => 0 and when i want to activate a user i simply flip the integer value to 1

Post a Comment for "Rails 3 And Sqlite Communications Concerning Boolians"