# File lib/her/model/orm.rb, line 183 def scope(name, code) # Add the scope method to the class (class << self; self end).send(:define_method, name) do |*args| instance_exec(*args, &code) end # Add the scope method to the default/blank relation scoped.define_singleton_method(name) { |*args| instance_exec(*args, &code) } end