Module: Neoid::ModelAdditions::ClassMethods

Defined in:
lib/neoid/model_additions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#neoid_configObject (readonly)

Returns the value of attribute neoid_config.



4
5
6
# File 'lib/neoid/model_additions.rb', line 4

def neoid_config
  @neoid_config
end

Instance Method Details

#neo_model_index_nameObject



23
24
25
26
# File 'lib/neoid/model_additions.rb', line 23

def neo_model_index_name
  raise 'Per Model index is not enabled. Nodes/Relationships are auto indexed with node_auto_index/relationship_auto_index' unless Neoid.config.enable_per_model_indexes || neoid_config.enable_model_index
  @index_name ||= "#{name.tableize}_index"
end

#neoidable(options = {}) {|neoid_config| ... } ⇒ Object

Yields:



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/neoid/model_additions.rb', line 10

def neoidable(options = {})
  # defaults
  neoid_config.auto_index = true
  neoid_config.enable_model_index = true # but the Neoid.enable_per_model_indexes is false by default. all models will be true only if the primary option is turned on.

  yield(neoid_config) if block_given?

  options.each do |key, value|
    raise "Neoid #{name} model options: No such option #{key}" unless neoid_config.respond_to?("#{key}=")
    neoid_config.send("#{key}=", value)
  end
end