Module: Searchlogic::NamedScopes::AssociationOrdering

Included in:
ActiveRecord::Base
Defined in:
lib/searchlogic/named_scopes/association_ordering.rb

Overview

Handles dynamically creating order named scopes for associations:

User.has_many :orders
Order.has_many :line_items
LineItem

User.ascend_by_orders_line_items_id

See the README for a more detailed explanation.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (private)



22
23
24
25
26
27
28
29
# File 'lib/searchlogic/named_scopes/association_ordering.rb', line 22

def method_missing(name, *args, &block)
  if details = association_ordering_condition_details(name)
    create_association_ordering_condition(details[:association], details[:order_as], details[:condition], args)
    send(name, *args)
  else
    super
  end
end

Instance Method Details

#condition?(name) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


13
14
15
# File 'lib/searchlogic/named_scopes/association_ordering.rb', line 13

def condition?(name) # :nodoc:
  super || association_ordering_condition?(name)
end