Sha256: 84ba3d3a28bedf3343fcfebb500bae26483672a88ef02235b5f16d325a7ffa13

Contents?: true

Size: 282 Bytes

Versions: 1

Compression:

Stored size: 282 Bytes

Contents

module Traits
  class Association
    module ReadOnly
      def mutable?
        !through? || source_association.macro == :belongs_to
      end

      def readonly?
        not mutable?
      end

      def to_hash
        super.merge!(mutable: mutable?)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-traits-1.0.0 lib/traits/concerns/association/read_only.rb