named_scope_patch.rb

lib/will_paginate/named_scope_patch.rb (view online)
Last Update: Wed Feb 25 05:03:04 +0000 2009

Public instance methods

method_missing (method, *args) {|*a| ...}
[show source]
# File lib/will_paginate/named_scope_patch.rb, line 26
  def method_missing(method, *args)
    if @target.respond_to?(method) || (!@reflection.klass.respond_to?(method) && Class.respond_to?(method))
      super
    elsif @reflection.klass.scopes.include?(method)
      @reflection.klass.scopes[method].call(self, *args)
    else
      @reflection.klass.with_scope(:find => { :conditions => @finder_sql, :joins => @join_sql, :readonly => false }) do
        @reflection.klass.send(method, *args) { |*a| yield(*a) if block_given? }
      end
    end
  end
method_missing_without_paginate (method, *args) {|*a| ...}
[show source]
# File lib/will_paginate/named_scope_patch.rb, line 13
    def method_missing_without_paginate(method, *args)
      if @reflection.klass.scopes.include?(method)
        @reflection.klass.scopes[method].call(self, *args) { |*a| yield(*a) if block_given? }
      else
        method_missing_without_scopes(method, *args) { |*a| yield(*a) if block_given? }
      end
    end
method_missing_without_scopes (method, *args)
with_scope (*args) {|*a| ...}
[show source]
# File lib/will_paginate/named_scope_patch.rb, line 3
  def with_scope(*args)
    @reflection.klass.send(:with_scope, *args) { |*a| yield(*a) if block_given? }
  end