Class: Effective::Region
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Effective::Region
- Defined in:
- app/models/effective/region.rb
Instance Method Summary collapse
- #global? ⇒ Boolean
-
#snippet_objects ⇒ Object
Hash of the Snippets objectified.
- #snippets ⇒ Object
Instance Method Details
#global? ⇒ Boolean
35 36 37 |
# File 'app/models/effective/region.rb', line 35 def global? regionable_id == nil && regionable_type == nil end |
#snippet_objects ⇒ Object
Hash of the Snippets objectified
Returns a Hash of => CurrentUserInfo.new(snippets[‘options’])
26 27 28 29 30 31 32 33 |
# File 'app/models/effective/region.rb', line 26 def snippet_objects @snippet_objects ||= snippets.map do |key, snippet| # Key here is 'snippet_1' if snippet['class_name'] klass = "Effective::Snippets::#{snippet['class_name'].classify}".safe_constantize klass.new(snippet.merge!(:region => self, :id => key)) if klass end end.compact end |
#snippets ⇒ Object
19 20 21 |
# File 'app/models/effective/region.rb', line 19 def snippets self[:snippets] || HashWithIndifferentAccess.new() end |