Module: Wakari::Content::Model::ClassMethods

Defined in:
lib/wakari/models/content/model.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_content_class(translation_class, association_name, options) ⇒ Object



11
12
13
14
# File 'lib/wakari/models/content/model.rb', line 11

def acts_as_content_class(translation_class, association_name, options)
  has_many association_name, :class_name => "::Object::#{translation_class.name}", :inverse_of => :content, :order => :position, :autosave => true, :foreign_key => :content_id
  default_scope { includes(association_name) }
end

#dom_classObject



24
25
26
# File 'lib/wakari/models/content/model.rb', line 24

def dom_class
  model_name.param_key
end

#i18n_default_scope(resource) ⇒ Object

:nodoc:



20
21
22
# File 'lib/wakari/models/content/model.rb', line 20

def i18n_default_scope(resource) #:nodoc:
  :"#{self.i18n_scope}.#{resource}.#{self.model_name.i18n_key.to_s}"
end

#i18n_namespaced_scope(resource) ⇒ Object

:nodoc:



16
17
18
# File 'lib/wakari/models/content/model.rb', line 16

def i18n_namespaced_scope(resource) #:nodoc:
  :"#{self.i18n_scope}.#{resource}.#{self.model_name.i18n_key.to_s.gsub(/\//,".")}"
end