module Queryable::Chainable::ClassMethods
Internal: Contains the Chainable
class methods.
Public Instance Methods
chain(*names)
click to toggle source
Public: Makes an existing method chainable by storing its return value as the internal query, and returning the query object itself.
Examples:
chain :order_by_name chain def search(field_values) field_values.inject(query) { |query, (field, value)| query.where(field => /#{value}/i) } end
# File lib/queryable/chainable.rb, line 25 def chain(*names) prepend Module.new.tap { |m| Chainable.add_scope_methods(m, names) } end