Module: Xhive::ActiveRecordExtensions::ClassMethods

Defined in:
lib/xhive/active_record_extensions.rb

Instance Method Summary collapse

Instance Method Details

#mount_page(attr) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/xhive/active_record_extensions.rb', line 6

def mount_page(attr)
  # Define getter
  mount_page_getter(attr.to_s)

  # Define setter
  mount_page_setter(attr)

  # Define content
  define_method("#{attr}_content") do |opts={}|
    self.send(attr.to_sym).present_content(opts.merge({self.class.name.downcase.to_sym => self}))
  end
end