Class: BazaModels::Ransacker
- Inherits:
-
Object
- Object
- BazaModels::Ransacker
- Defined in:
- lib/baza_models/ransacker.rb
Defined Under Namespace
Classes: RelationshipScanner
Instance Attribute Summary collapse
-
#db ⇒ Object
readonly
Returns the value of attribute db.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#query ⇒ Object
Returns the value of attribute query.
Instance Method Summary collapse
-
#initialize(args) ⇒ Ransacker
constructor
A new instance of Ransacker.
- #result ⇒ Object
Constructor Details
#initialize(args) ⇒ Ransacker
Returns a new instance of Ransacker.
7 8 9 10 11 12 13 |
# File 'lib/baza_models/ransacker.rb', line 7 def initialize(args) @klass = args.fetch(:class) @db = @klass.db @params = args.fetch(:params) @_registered_params = @params # Support for SimpleFormRansack @query = args.fetch(:query) end |
Instance Attribute Details
#db ⇒ Object (readonly)
Returns the value of attribute db.
5 6 7 |
# File 'lib/baza_models/ransacker.rb', line 5 def db @db end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
5 6 7 |
# File 'lib/baza_models/ransacker.rb', line 5 def klass @klass end |
#query ⇒ Object
Returns the value of attribute query.
4 5 6 |
# File 'lib/baza_models/ransacker.rb', line 4 def query @query end |
Instance Method Details
#result ⇒ Object
15 16 17 18 |
# File 'lib/baza_models/ransacker.rb', line 15 def result add_filters_to_query unless @add_filters_to_query_executed @query end |