module Granite::Represents::ClassMethods

Private Instance Methods

represents(*fields, &block) click to toggle source
# File lib/granite/represents.rb, line 10
def represents(*fields, &block)
  options = fields.extract_options!.symbolize_keys

  fields.each do |field|
    add_attribute Granite::Represents::Reflection, field, options, &block

    assign_data { attribute(field).sync if attribute(field).changed? }
  end
end