Module: EIVO::Concerns::Resources
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/eivo/concerns/resources.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/eivo/concerns/resources.rb', line 20 def create @object ||= collection.new @object.assign_attributes(object_params_create) if @object.save redirect_to action: :index else render :new end end |
#destroy ⇒ Object
46 47 48 49 50 51 |
# File 'app/controllers/eivo/concerns/resources.rb', line 46 def destroy @object ||= collection.find(params[:id]) @object.destroy redirect_to action: :index end |
#edit ⇒ Object
31 32 33 |
# File 'app/controllers/eivo/concerns/resources.rb', line 31 def edit @object ||= collection.find(params[:id]) end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/eivo/concerns/resources.rb', line 8 def index @objects ||= collection_index end |
#new ⇒ Object
16 17 18 |
# File 'app/controllers/eivo/concerns/resources.rb', line 16 def new @object ||= collection.new end |
#show ⇒ Object
12 13 14 |
# File 'app/controllers/eivo/concerns/resources.rb', line 12 def show @object ||= collection_show.find(params[:id]) end |
#update ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/eivo/concerns/resources.rb', line 35 def update @object ||= collection.find(params[:id]) @object.assign_attributes(object_params_update) if @object.update(object_params_update) redirect_to action: :index else render :edit end end |