Module: Tenon::TenonContent::ClassMethods

Defined in:
lib/tenon/tenon_content.rb

Instance Method Summary collapse

Instance Method Details

#tenon_content(content_field, i18n: false) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/tenon/tenon_content.rb', line 8

def tenon_content(content_field, i18n: false)
  Tenon::TenonContentBuilder.add_assoc(self, content_field)

  define_method("#{content_field}_i18n?") { i18n }
  if i18n && Tenon.config.languages
    Tenon.config.languages.each do |title, lang|
      Tenon::TenonContentBuilder.add_assoc(self, "#{content_field}_#{lang}")
    end
  end
end