Sha256: 95bae9d0b8d84acff75c53d0e2a249ea9628bfbaae53add6b0048530ab3b7b48

Contents?: true

Size: 654 Bytes

Versions: 32

Compression:

Stored size: 654 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) unless args[1][:_index] == false
      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

32 entries across 32 versions & 1 rubygems

Version Path
neo4j-9.3.0 lib/neo4j/active_node/enum.rb
neo4j-9.2.4 lib/neo4j/active_node/enum.rb
neo4j-9.2.3 lib/neo4j/active_node/enum.rb
neo4j-9.2.2 lib/neo4j/active_node/enum.rb
neo4j-9.2.1 lib/neo4j/active_node/enum.rb
neo4j-9.2.0 lib/neo4j/active_node/enum.rb
neo4j-9.1.8 lib/neo4j/active_node/enum.rb
neo4j-9.1.7 lib/neo4j/active_node/enum.rb
neo4j-9.1.6 lib/neo4j/active_node/enum.rb
neo4j-9.1.5 lib/neo4j/active_node/enum.rb
neo4j-9.1.4 lib/neo4j/active_node/enum.rb
neo4j-9.1.3 lib/neo4j/active_node/enum.rb
neo4j-9.1.2 lib/neo4j/active_node/enum.rb
neo4j-9.1.1 lib/neo4j/active_node/enum.rb
neo4j-9.1.0 lib/neo4j/active_node/enum.rb
neo4j-9.0.7 lib/neo4j/active_node/enum.rb
neo4j-9.0.6 lib/neo4j/active_node/enum.rb
neo4j-9.0.5 lib/neo4j/active_node/enum.rb
neo4j-8.3.4 lib/neo4j/active_node/enum.rb
neo4j-9.0.4 lib/neo4j/active_node/enum.rb