ruby - ActiveRecord boolean value returning "f", "t" -
i've added boolean column active record migration
class addincludeinconsolidationtocompanies < activerecord::migration def change add_column :companies, :include_in_consolidation, :bool, :default => true end end
whenever fetch record database "f" or "t" instead of true or false.
is activerecord not supposed automatically handle type casting , database.
it's activerecord::base.connection.quoted_true/false
defaulting true.
what best way around this? ideally should work, boolean column should return boolean default not string.
't' , 'f' postgresql uses boolean values.
'bool' not valid datatype rails migration. need use 'boolean'. guess 'bool' getting column created in database, rails confused when data loaded model. change , rerun migration , bet works out.
Comments
Post a Comment