Class: Texter::Text
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Texter::Text
- Defined in:
- app/models/texter/text.rb
Constant Summary collapse
- BLOCK =
'block'
- TAG_TYPES =
[BLOCK, 'inline']
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
Class Method Details
.find_or_create_from_translations_by_path(path) ⇒ Object
11 12 13 14 15 |
# File 'app/models/texter/text.rb', line 11 def self.find_or_create_from_translations_by_path(path) text = find_or_initialize_by_path(path) text.new_record? && text.update_attributes(text.default_attributes) text end |
Instance Method Details
#default_attributes ⇒ Object
29 30 31 |
# File 'app/models/texter/text.rb', line 29 def default_attributes { :body => get_body } end |
#get_body(options = {}) ⇒ Object
21 22 23 |
# File 'app/models/texter/text.rb', line 21 def get_body( = {}) persisted? ? body : Texter.translate(path, ) end |
#to_param ⇒ Object
17 18 19 |
# File 'app/models/texter/text.rb', line 17 def to_param path end |