Sha256: f150bb1113e3c684bb530fae2b72d1c88db340766a995c3590fc6d99d89b633c
Contents?: true
Size: 739 Bytes
Versions: 1
Compression:
Stored size: 739 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 scope :with_locale, lambda {|locale| joins(:contents).where(georgia_contents: {locale: locale})} def content(locale=nil) locale ||= I18n.locale.to_s @content ||= contents.select{|c| c.locale == locale}.first || Georgia::Content.new end delegate :title, :text, :excerpt, :keywords, :keyword_list, :image, :locale, to: :content end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
georgia-0.7.6 | app/models/georgia/concerns/contentable.rb |