Module: DataDisplay::ModelAdditions::ClassMethods

Defined in:
lib/data_display/model_additions.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_displayable(*args) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/data_display/model_additions.rb', line 7

def acts_as_displayable(*args)
  args = columns.map(&:name) if args.blank?
  args.each do |attribute|
    define_method "#{attribute}_display" do |format = nil|
      __data_display__(send(attribute), format)
    end
  end
end