Module: Ransack::Adapters::ActiveRecord::Base
- Defined in:
- lib/ransack/adapters/active_record/base.rb
Class Method Summary collapse
Instance Method Summary collapse
- #ransack(params = {}, options = {}) ⇒ Object
- #ransackable_associations(auth_object = nil) ⇒ Object
- #ransackable_attributes(auth_object = nil) ⇒ Object
- #ransacker(name, opts = {}, &block) ⇒ Object
Class Method Details
.extended(base) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/ransack/adapters/active_record/base.rb', line 6 def self.extended(base) alias :search :ransack unless base.method_defined? :search base.class_eval do class_attribute :_ransackers self._ransackers ||= {} end end |
Instance Method Details
#ransack(params = {}, options = {}) ⇒ Object
14 15 16 |
# File 'lib/ransack/adapters/active_record/base.rb', line 14 def ransack(params = {}, = {}) Search.new(self, params, ) end |
#ransackable_associations(auth_object = nil) ⇒ Object
26 27 28 |
# File 'lib/ransack/adapters/active_record/base.rb', line 26 def ransackable_associations(auth_object = nil) reflect_on_all_associations.map {|a| a.name.to_s} end |
#ransackable_attributes(auth_object = nil) ⇒ Object
22 23 24 |
# File 'lib/ransack/adapters/active_record/base.rb', line 22 def ransackable_attributes(auth_object = nil) column_names + _ransackers.keys end |