Module: HasContent::ContentOwner

Extended by:
ActiveSupport::Concern
Defined in:
lib/has_content/content_owner.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#attributesObject

include content_attributes in attributes hash



20
21
22
# File 'lib/has_content/content_owner.rb', line 20

def attributes
  super.merge content_attributes
end

#content_attributesObject

return a hash of content attributes with their content only (for loaded content only)



12
13
14
15
16
17
# File 'lib/has_content/content_owner.rb', line 12

def content_attributes
  content_names.inject({}) do |attrs, name|
    attrs.merge!(name => send(name)) if send("#{name}_content")
    attrs
  end
end