Module: Gluttonberg::Content::Block::ClassMethods
- Defined in:
- lib/gluttonberg/content/block.rb
Instance Method Summary collapse
-
#all_with_localization(opts) ⇒ Object
Returns all the matching models with the specificed localization loaded.
-
#is_localized(&blk) ⇒ Object
This declaration is used to create properties on a model which need to be localized.
-
#localized? ⇒ Boolean
Does this class have an associated localization class.
Instance Method Details
#all_with_localization(opts) ⇒ Object
Returns all the matching models with the specificed localization loaded.
59 60 61 62 63 64 |
# File 'lib/gluttonberg/content/block.rb', line 59 def all_with_localization(opts) page_localization_id = opts.delete(:page_localization_id) results = all(opts) results.each { |r| r.load_localization(page_localization_id) } results end |
#is_localized(&blk) ⇒ Object
This declaration is used to create properties on a model which need to be localized. It does this by generating a localized class and association.
It also registers the class as being localized.
47 48 49 50 51 |
# File 'lib/gluttonberg/content/block.rb', line 47 def is_localized(&blk) self.localized = true self.attr_accessible :section_name create_localization_model(&blk) end |
#localized? ⇒ Boolean
Does this class have an associated localization class.
54 55 56 |
# File 'lib/gluttonberg/content/block.rb', line 54 def localized? self.localized end |