I first had this problem like a week ago and being unable to solve it I went "meanwhile to look other aspects of my application.Today I'm back to the problem and regardless the fact I've isolated it still don't know its nature
I have a migration that goes like:
class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.references "faculty" t.references "department" t.references "role", :null => false t.string "name", :null => false, :limit => 20 t.string "surname", :null => false, :limit => 20 t.string "username",:null => false, :limit => 25 t.string "study_group",:limit => 6 t.string "study_course",:limit => 50 t.string "card_code",:limit => 12 t.boolean "During_Day",:default => false t.string "email", :limit => 100 t.string "hashed_password", :limit => 40 t.string "salt", :limit => 40 end end
def self.down drop_table :users end end
If I start to create users from the rails console and save them when trying to recover the data through
User.all
some fields' info would be corrupted.I started to remove fields and it works when I leave the first 8 columns (including the ID which is created by default).Creating a ninth column or even more would damage everything and afterwards I'm getting all kind of not correct information at my views. I must say that when from the rails console I save something and then check it from the mysql command line then the info is fine....so what's ActiveRecord missing?