Sha256: 9ad65c00702850f2d73269a6531643b8f696f47ec5fcce5a7273df331c31e19c

Contents?: true

Size: 486 Bytes

Versions: 3

Compression:

Stored size: 486 Bytes

Contents

require 'rubytree'

module Rooler
  class Template < ActiveRecord::Base
    has_many :rules
    has_many :deliveries, as: :deliverable
    validates :name, :to, :subject, :body, presence: true
    
    def test_object
      object = nil
      rules.each do |rule|
        object = rule.send(:find_by_klass).first
        break if object
      end
      object ||= nil
    end
    
    
    def liquid_method_tree
      LiquidInspector.new(test_object.class).tree
    end
    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rooler-0.0.5 app/models/rooler/template.rb
rooler-0.0.4 app/models/rooler/template.rb
rooler-0.0.3 app/models/rooler/template.rb