Class: Peck::Rails::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/peck_on_rails/model.rb

Class Method Summary collapse

Class Method Details

.init(context, context_type, subject) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/peck_on_rails/model.rb', line 4

def self.init(context, context_type, subject)
  if [:model, :controller, :helper].include?(context_type)
    Peck.log("Peck::Rails::Model.init")
    context.class_eval do
      if defined?(::ActiveRecord)
        include ::ActiveRecord::TestFixtures
      end
      self.fixture_path = File.join(::Rails.root, 'test', 'fixtures')
      fixtures :all
      define_method(:method_name) { self.class.label }
    end
  end
end