I have a model object User which has a JSON(mysql 5.7 JSON column too) column in it. My model object looks like this
class User < ActiveRecord::Base
after_initialize :set_defaults
serialize :group_condition, JSON
def set_defaults
self.group_condition ||= []
end
end
When I create a new object using User.new, when set_defaults is called, I am getting this error. input must be a string or IO
During the initialization of User object group_condition is null and it will be added with user given input later on. But, Coz of input must be a string or IO
error I am not able to proceed. Any Help will be much appreciated
Aucun commentaire:
Enregistrer un commentaire