Module: Templatr::ActsAsTemplatable::InstanceMethods
- Defined in:
- lib/templatr/acts_as_templatable.rb
Instance Method Summary collapse
- #additional_tags ⇒ Object
-
#can_change_template? ⇒ Boolean
Returns true if the record is still able to choose which template to use.
- #template_tags(options = {}) ⇒ Object
Instance Method Details
#additional_tags ⇒ Object
100 101 102 |
# File 'lib/templatr/acts_as_templatable.rb', line 100 def .where("field_id IS NULL") end |
#can_change_template? ⇒ Boolean
Returns true if the record is still able to choose which template to use
85 86 87 |
# File 'lib/templatr/acts_as_templatable.rb', line 85 def can_change_template? !persisted? || !template.present? end |
#template_tags(options = {}) ⇒ Object
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/templatr/acts_as_templatable.rb', line 89 def ( = {}) = .joins(:field).reorder('templatr_fields.field_group_id, templatr_fields.order') return unless [:include_blank] # Add non-populated tags so that they show in the form template_fields.collect do |field| .detect {|tag| tag.field == field } || Tag.new(:field => field) end end |