Sha256: 58f2566b804e0ac39333ab9603e60e3deaa11888f2509d0af1f9ade6f9ea6801

Contents?: true

Size: 804 Bytes

Versions: 6

Compression:

Stored size: 804 Bytes

Contents

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

begin
  require 'property_sets/action_view_extension'
rescue LoadError
end

module PropertySets
  VERSION = "0.7.2"

  def self.ensure_property_set_class(association, owner_class)
    const_name = "#{owner_class.name}#{association.to_s.singularize.capitalize}".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
      property_class.owner_assoc = association
    end
    Object.const_get(const_name)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
property_sets-2.0.1 lib/property_sets.rb
property_sets-2.0.0 lib/property_sets.rb
property_sets-1.0.5 lib/property_sets.rb
property_sets-1.0.4 lib/property_sets.rb
property_sets-1.0.0 lib/property_sets.rb
property_sets-0.8.3 lib/property_sets.rb