Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/without_instanciation.rb
Class Method Summary collapse
Class Method Details
.without_instanciation(opt = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/without_instanciation.rb', line 4 def without_instanciation opt={} eigenclass = (class << self; self end) Psychanalyst.redefine(eigenclass, :find_by_sql) do |sql| connection.select_all(sanitize_sql(sql), "#{name} Load") end result = yield Psychanalyst.undefine(eigenclass, :find_by_sql) result end |