Sha256: 9a1ac24b33c230026c343cbefb986a233084339d8d3a949a50f742132f6570bc

Contents?: true

Size: 450 Bytes

Versions: 2

Compression:

Stored size: 450 Bytes

Contents

module StaticRecord
  class Railtie < Rails::Railtie # :nodoc:
    initializer 'static_record.insert_into_active_record' do |_app|
      ActiveSupport.on_load :active_record do
        StaticRecord::Railtie.insert
      end
    end

    def self.insert
      if defined?(ActiveRecord)
        ActiveRecord::Base.send(:include, StaticRecord::Schema)
        ActiveRecord::Base.send(:include, StaticRecord::HasStaticRecord)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
static-record-1.0.0 lib/static_record/migrations/railtie.rb
static-record-1.0.0.pre.4 lib/static_record/migrations/railtie.rb