motion/managed_object.rb
# Creates a CDQ scope, but also defines a method on the class that returns the
# query directly.
#
Creates a CDQ scope, but also defines a method on the class that returns the
query directly.
Creates a CDQ scope but also defines a method on the class that returns the query directly .
def scope(name, query = nil, &block)
      cdq.scope(name, query, &block)
      if query
        self.class.send(:define_method, name) do
          where(query)
        end
      else
        self.class.send(:define_method, name) do |*args|
          where(block.call(*args))
        end
      end
    end
def scope ( name , query = nil , & block ) cdq . scope ( name , query , & block ) if query self . class . send ( :define_method , name ) do where ( query ) end else self . class . send ( :define_method , name ) do | * args | where ( block . call ( * args ) ) end end end
Creates a CDQ scope, but also defines a method on the class that returns the
query directly.
Creates a CDQ scope but also defines a method on the class that returns the query directly .
name
<not_specific>
query
<not_specific>
block
<not_specific>