Enumerize::ActiveRecordSupport::InstanceMethods

Public Instance Methods

becomes(klass) click to toggle source

Support multiple enumerized attributes

# File lib/enumerize/activerecord.rb, line 55
def becomes(klass)
  became = super
  klass.enumerized_attributes.each do |attr|
    if attr.is_a? Multiple
      became.send("#{attr.name}=", send(attr.name))
    end
  end

  became
end
write_attribute(attr_name, value) click to toggle source

github.com/brainspec/enumerize/issues/74

# File lib/enumerize/activerecord.rb, line 46
def write_attribute(attr_name, value)
  if self.class.enumerized_attributes[attr_name]
    _enumerized_values_for_validation[attr_name] = value
  end

  super
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.