Sha256: be210c367a32a153ebe4e45158df1b012f8a0e4d2421d251fb1227cad2978caa

Contents?: true

Size: 593 Bytes

Versions: 6

Compression:

Stored size: 593 Bytes

Contents

require 'active_support/concern'

module Georgia
  module Concerns
    module Contentable
      extend ActiveSupport::Concern

      included do
        has_many :contents, as: :contentable, dependent: :destroy, class_name: Georgia::Content
        accepts_nested_attributes_for :contents
        attr_accessible :contents_attributes

        def content
          @content ||= contents.select{|c| c.locale == I18n.locale.to_s}.first || Georgia::Content.new
        end

				delegate :title, :text, :excerpt, :keywords, :keyword_list, :image, :locale, to: :content
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
georgia-0.7.5 app/models/georgia/concerns/contentable.rb
georgia-0.7.4 app/models/georgia/concerns/contentable.rb
georgia-0.7.3 app/models/georgia/concerns/contentable.rb
georgia-0.7.2 app/models/georgia/concerns/contentable.rb
georgia-0.7.1 app/models/georgia/concerns/contentable.rb
georgia-0.7.0 app/models/georgia/concerns/contentable.rb