Sha256: 28cff9cc4c9abe098768c8456b63eb75f37ae5d4c79cfbd6d5ff8ab1183ebcce

Contents?: true

Size: 824 Bytes

Versions: 18

Compression:

Stored size: 824 Bytes

Contents

require 'property_sets/property_set_model'
require 'property_sets/active_record_extension'
require 'property_sets/version'

begin
  require 'property_sets/action_view_extension'
rescue LoadError
end

module PropertySets
  def self.ensure_property_set_class(association, owner_class_name)
    const_name = "#{owner_class_name}#{association.to_s.singularize.camelcase}".to_sym
    unless Object.const_defined?(const_name)
      property_class = Object.const_set(const_name, Class.new(ActiveRecord::Base))
      property_class.class_eval do
        include PropertySets::PropertySetModel::InstanceMethods
        extend  PropertySets::PropertySetModel::ClassMethods
      end

      property_class.owner_class = owner_class_name
      property_class.owner_assoc = association
    end
    Object.const_get(const_name)
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
property_sets-3.6.0 lib/property_sets.rb
property_sets-3.5.6 lib/property_sets.rb
property_sets-3.5.5 lib/property_sets.rb
property_sets-3.5.4 lib/property_sets.rb
property_sets-3.5.3 lib/property_sets.rb
property_sets-3.5.1 lib/property_sets.rb
property_sets-3.5.0 lib/property_sets.rb
property_sets-3.4.0 lib/property_sets.rb
property_sets-3.3.1 lib/property_sets.rb
property_sets-3.3.0 lib/property_sets.rb
property_sets-3.2.1 lib/property_sets.rb
property_sets-3.2.0 lib/property_sets.rb
property_sets-3.1.1 lib/property_sets.rb
property_sets-3.1.0 lib/property_sets.rb
property_sets-3.0.0 lib/property_sets.rb
property_sets-2.10.0 lib/property_sets.rb
property_sets-2.9.1 lib/property_sets.rb
property_sets-2.9.0 lib/property_sets.rb