Class: RepresentationsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RepresentationsController
- Includes:
- PermittedParameters
- Defined in:
- app/controllers/representations_controller.rb
Overview
Handles CRUD actions for Representation objects
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/representations_controller.rb', line 30 def create self.representation = current_resource.representations.new(representation_params) if representation.save logger.info "Created #{representation} for #{current_resource}" redirect_to representation, notice: 'The description has been created' else logger.warn "Unable to create description due to '#{representation.error_sentence}'" render :new end end |
#destroy ⇒ Object
52 53 54 55 |
# File 'app/controllers/representations_controller.rb', line 52 def destroy representation.destroy redirect_to organization_representations_url(current_organization), notice: 'Description was successfully destroyed.' end |
#edit ⇒ Object
27 28 |
# File 'app/controllers/representations_controller.rb', line 27 def edit end |
#index ⇒ Object
14 15 |
# File 'app/controllers/representations_controller.rb', line 14 def index end |
#new ⇒ Object
20 21 22 23 24 25 |
# File 'app/controllers/representations_controller.rb', line 20 def new self.representation = current_resource.representations.new({ language: Rails.configuration.x.default_representation_language, author: current_user }) end |
#show ⇒ Object
17 18 |
# File 'app/controllers/representations_controller.rb', line 17 def show end |
#update ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/representations_controller.rb', line 42 def update if representation.update(representation_params) logger.info "Updated #{representation}" redirect_to representation_path(representation), notice: 'The description has been updated' else logger.warn "Unable to update description due to '#{representation.error_sentence}'" render :edit end end |