Sha256: bdf1fcafb326f5aaea889246a5a7c6714d3ed6a0b3317b3cbd788a587e3273a6

Contents?: true

Size: 778 Bytes

Versions: 62

Compression:

Stored size: 778 Bytes

Contents

require 'active_type/nested_attributes/builder'

module ActiveType

  module NestedAttributes

    extend ActiveSupport::Concern

    included do
      attr_accessor :_nested_attribute_scopes
    end

    module ClassMethods

      def nests_one(association_name, options = {})
        Builder.new(self, generated_nested_attribute_methods).build(association_name, :one, options)
      end

      def nests_many(association_name, options = {})
        Builder.new(self, generated_nested_attribute_methods).build(association_name, :many, options)
      end


      private

      def generated_nested_attribute_methods
        @generated_nested_attribute_methods ||= begin
          mod = Module.new
          include mod
          mod
        end
      end

    end

  end

end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
active_type-2.6.1 lib/active_type/nested_attributes.rb
active_type-2.6.0 lib/active_type/nested_attributes.rb
active_type-2.5.1 lib/active_type/nested_attributes.rb
active_type-2.5.0 lib/active_type/nested_attributes.rb
active_type-2.4.1 lib/active_type/nested_attributes.rb
active_type-2.4.0 lib/active_type/nested_attributes.rb
active_type-2.3.4 lib/active_type/nested_attributes.rb
active_type-2.3.3 lib/active_type/nested_attributes.rb
active_type-2.3.2 lib/active_type/nested_attributes.rb
active_type-2.3.1 lib/active_type/nested_attributes.rb
active_type-2.3.0 lib/active_type/nested_attributes.rb
active_type-2.2.0 lib/active_type/nested_attributes.rb
active_type-2.1.2 lib/active_type/nested_attributes.rb
active_type-2.1.1 lib/active_type/nested_attributes.rb
active_type-2.1.0 lib/active_type/nested_attributes.rb
active_type-2.0 lib/active_type/nested_attributes.rb
active_type-1.10.1 lib/active_type/nested_attributes.rb
active_type-1.10.0 lib/active_type/nested_attributes.rb
active_type-1.9.1 lib/active_type/nested_attributes.rb
active_type-1.9.0 lib/active_type/nested_attributes.rb