Module: Sequel::Plugins::AutoRestrictEagerGraph::ClassMethods

Defined in:
lib/sequel/plugins/auto_restrict_eager_graph.rb

Instance Method Summary collapse

Instance Method Details

#associate(type, name, opts = OPTS, &block) ⇒ Object

When defining an association, if a block is given for the association, but a :graph_* option is not used, disallow the use of eager_graph.



50
51
52
53
54
55
56
57
58
# File 'lib/sequel/plugins/auto_restrict_eager_graph.rb', line 50

def associate(type, name, opts = OPTS, &block)
  opts = super

  if opts[:block] && !opts.has_key?(:allow_eager_graph) && !opts[:orig_opts].any?{|k,| /\Agraph_/ =~ k}
    opts[:allow_eager_graph] = false
  end

  opts
end