Class: RocketJobMissionControl::Query
- Inherits:
-
Object
- Object
- RocketJobMissionControl::Query
- Defined in:
- app/models/rocket_job_mission_control/query.rb
Instance Attribute Summary collapse
-
#display_columns ⇒ Object
Returns the value of attribute display_columns.
-
#order_by ⇒ Object
Returns the value of attribute order_by.
-
#page_size ⇒ Object
Returns the value of attribute page_size.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#search_columns ⇒ Object
Returns the value of attribute search_columns.
-
#search_term ⇒ Object
Returns the value of attribute search_term.
-
#start ⇒ Object
Returns the value of attribute start.
Instance Method Summary collapse
-
#count ⇒ Object
Count after applying search_term.
-
#initialize(scope, order_by = nil) ⇒ Query
constructor
A new instance of Query.
-
#query ⇒ Object
Returns the filtered query expression with the sort applied.
-
#unfiltered_count ⇒ Object
Count before applying search term Pagination settings do not affect this count.
Constructor Details
#initialize(scope, order_by = nil) ⇒ Query
Returns a new instance of Query.
7 8 9 10 11 12 |
# File 'app/models/rocket_job_mission_control/query.rb', line 7 def initialize(scope, order_by = nil) @scope = scope @order_by = order_by @search_columns = [] @display_columns = [] end |
Instance Attribute Details
#display_columns ⇒ Object
Returns the value of attribute display_columns.
4 5 6 |
# File 'app/models/rocket_job_mission_control/query.rb', line 4 def display_columns @display_columns end |
#order_by ⇒ Object
Returns the value of attribute order_by.
4 5 6 |
# File 'app/models/rocket_job_mission_control/query.rb', line 4 def order_by @order_by end |
#page_size ⇒ Object
Returns the value of attribute page_size.
4 5 6 |
# File 'app/models/rocket_job_mission_control/query.rb', line 4 def page_size @page_size end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
3 4 5 |
# File 'app/models/rocket_job_mission_control/query.rb', line 3 def scope @scope end |
#search_columns ⇒ Object
Returns the value of attribute search_columns.
4 5 6 |
# File 'app/models/rocket_job_mission_control/query.rb', line 4 def search_columns @search_columns end |
#search_term ⇒ Object
Returns the value of attribute search_term.
4 5 6 |
# File 'app/models/rocket_job_mission_control/query.rb', line 4 def search_term @search_term end |
#start ⇒ Object
Returns the value of attribute start.
4 5 6 |
# File 'app/models/rocket_job_mission_control/query.rb', line 4 def start @start end |
Instance Method Details
#count ⇒ Object
Count after applying search_term. Pagination settings do not affect this count.
22 23 24 |
# File 'app/models/rocket_job_mission_control/query.rb', line 22 def count unsorted_query.count end |
#query ⇒ Object
Returns the filtered query expression with the sort applied
15 16 17 18 |
# File 'app/models/rocket_job_mission_control/query.rb', line 15 def query # Sort must be applied last order_by ? unsorted_query.sort(order_by) : unsorted_query end |
#unfiltered_count ⇒ Object
Count before applying search term Pagination settings do not affect this count.
28 29 30 |
# File 'app/models/rocket_job_mission_control/query.rb', line 28 def unfiltered_count scope.count end |