searchlogic
searchlogic copied to clipboard
scope_procedure should send arguments if the options is a symbol
class User < ActiveRecord::Base scope_procedure :foo, :bar def self.bar(foo) end end
User.foo("bar") will raise arguments not matching error.
The issue code should be:
def alias_scope(name, options = nil)
alias_scopes[name.to_sym] = options
(class << self; self end).instance_eval do
define_method name do |*args|
case options
when Symbol
send(options) # should be send(options, *args)
else
options.call(*args)
end
end
end
end