Class: Gearhead::Actions::Index
- Inherits:
-
Object
- Object
- Gearhead::Actions::Index
- Defined in:
- lib/gearhead/actions/index.rb
Instance Attribute Summary collapse
-
#gear ⇒ Object
readonly
Returns the value of attribute gear.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(gear, request) ⇒ Index
constructor
A new instance of Index.
Constructor Details
#initialize(gear, request) ⇒ Index
Returns a new instance of Index.
11 12 13 14 15 16 |
# File 'lib/gearhead/actions/index.rb', line 11 def initialize(gear, request) @gear = gear @request = request @collection = find_collection @serializer_options = {} end |
Instance Attribute Details
#gear ⇒ Object (readonly)
Returns the value of attribute gear.
10 11 12 |
# File 'lib/gearhead/actions/index.rb', line 10 def gear @gear end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
10 11 12 |
# File 'lib/gearhead/actions/index.rb', line 10 def request @request end |
Class Method Details
.build(gear, request) ⇒ Object
6 7 8 |
# File 'lib/gearhead/actions/index.rb', line 6 def self.build(gear, request) new(gear, request).build end |
Instance Method Details
#build ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/gearhead/actions/index.rb', line 18 def build @collection = apply_includes @collection = apply_scope @collection = apply_query @collection = apply_pagination @collection = apply_serializer @collection.to_json end |