Sha256: a1886229c30eeb773fb5ac0608b89503fc6a68f5cace1f9d4f2aab8b259c5d6a

Contents?: true

Size: 621 Bytes

Versions: 42

Compression:

Stored size: 621 Bytes

Contents

module Neo4j::ActiveNode
  module Enum
    extend ActiveSupport::Concern
    include Neo4j::Shared::Enum

    module ClassMethods
      protected

      def define_property(property_name, *args)
        super
        Neo4j::ModelSchema.add_required_index(self, property_name)
      end

      def define_enum_methods(property_name, enum_keys, options)
        super
        define_enum_scopes(property_name, enum_keys)
      end

      def define_enum_scopes(property_name, enum_keys)
        enum_keys.keys.each do |name|
          scope name, -> { where(property_name => name) }
        end
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
neo4j-8.2.1 lib/neo4j/active_node/enum.rb
neo4j-8.1.5 lib/neo4j/active_node/enum.rb
neo4j-8.1.4 lib/neo4j/active_node/enum.rb
neo4j-8.1.3 lib/neo4j/active_node/enum.rb
neo4j-8.1.2 lib/neo4j/active_node/enum.rb
neo4j-8.1.1 lib/neo4j/active_node/enum.rb
neo4j-8.1.0 lib/neo4j/active_node/enum.rb
neo4j-8.1.0.rc.2 lib/neo4j/active_node/enum.rb
neo4j-8.0.18 lib/neo4j/active_node/enum.rb
neo4j-8.1.0.rc.1 lib/neo4j/active_node/enum.rb
neo4j-8.0.17 lib/neo4j/active_node/enum.rb
neo4j-8.0.16 lib/neo4j/active_node/enum.rb
neo4j-8.0.15 lib/neo4j/active_node/enum.rb
neo4j-8.0.13 lib/neo4j/active_node/enum.rb
neo4j-8.0.12 lib/neo4j/active_node/enum.rb
neo4j-8.0.11 lib/neo4j/active_node/enum.rb
neo4j-8.0.10 lib/neo4j/active_node/enum.rb
neo4j-8.0.9 lib/neo4j/active_node/enum.rb
neo4j-8.0.8 lib/neo4j/active_node/enum.rb
neo4j-8.0.7 lib/neo4j/active_node/enum.rb