Checking arity of scopes

All,
In the course of working on a change for the meta-search gem I've run
into an issue with the way that scopes are implemented in
ActiveRecord. In order to include a scope in a search we pass the name
of the scope to a search method like so: {:name_of_my_scope => 1}.
Meta-search automatically passes the "1" as an argument to the scope.
This causes an ArgumentError with lambda scopes that don't take an
argument.

My intention was to check the arity of the scope before calling and
dropping the "1" in the event the scope didn't take an argument. My
issue is that the implementation of scope wraps scope_options up in a
lambda that passes *args to the block (active_record/named_scope.rb:
106). This results in the call to arity always returning -1 regardless
of the actual number of arguments required by the scope definition.

Is there a different way to implement scopes that would allow exposing
the arity from the scope definition?

Ex.

class Post < ActiveRecord::Base
scope :today, lambda {where(:created_at => (Time.new.beginning_of_day)…
(Time.new.end_of_day)) }
end

Post.today.arity # => -1

Thanks,
Matthew