Module: Rows::Resources
- Included in:
- RowsController
- Defined in:
- lib/rows/resources.rb
Instance Method Summary collapse
- #resource ⇒ Object
- #resources ⇒ Object
- #set_resource(row = nil) ⇒ Object
- #set_resources(rows = nil) ⇒ Object
Instance Method Details
#resource ⇒ Object
20 21 22 |
# File 'lib/rows/resources.rb', line 20 def resource @row ||= set_resource end |
#resources ⇒ Object
16 17 18 |
# File 'lib/rows/resources.rb', line 16 def resources @rows ||= set_resources end |
#set_resource(row = nil) ⇒ Object
10 11 12 13 14 |
# File 'lib/rows/resources.rb', line 10 def set_resource(row = nil) row ||= model_class.find_by_id(params[:id].to_i) instance_variable_set("@#{model_symbol}", row) @row = row end |
#set_resources(rows = nil) ⇒ Object
4 5 6 7 8 |
# File 'lib/rows/resources.rb', line 4 def set_resources(rows = nil) rows ||= model_class.all instance_variable_set("@#{model_symbol_plural}", rows) @rows = rows end |