Sha256: 9bd5fec3b22de03a91f743e6a1a81ee46267ac1ca1cae5ad7f8184464d453b70

Contents?: true

Size: 728 Bytes

Versions: 25

Compression:

Stored size: 728 Bytes

Contents

module Protobuf
  module ActiveRecord
    module NestedAttributes
      extend ::ActiveSupport::Concern

      included do
        include ::Heredity::InheritableClassInstanceVariables

        class << self
          attr_accessor :_protobuf_nested_attributes
        end

        @_protobuf_nested_attributes = []

        inheritable_attributes :_protobuf_nested_attributes
      end

      module ClassMethods
        # :nodoc
        def accepts_nested_attributes_for(*attr_names)
          attribute_names = attr_names.dup
          attribute_names.extract_options!

          super

          self._protobuf_nested_attributes += attribute_names.map { |name| "#{name}_attributes" }
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
protobuf-activerecord-3.1.0.alpha lib/protobuf/active_record/nested_attributes.rb
protobuf-activerecord-3.0.2 lib/protobuf/active_record/nested_attributes.rb
protobuf-activerecord-3.0.1 lib/protobuf/active_record/nested_attributes.rb
protobuf-activerecord-3.0.0 lib/protobuf/active_record/nested_attributes.rb
protobuf-activerecord-3.0.0.rc4 lib/protobuf/active_record/nested_attributes.rb