Class: ContextsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ContextsController
- Defined in:
- app/controllers/contexts_controller.rb
Overview
Handles requests for Context information
Instance Method Summary collapse
-
#create ⇒ Object
POST /contexts.
-
#destroy ⇒ Object
DELETE /contexts/1.
-
#edit ⇒ Object
GET /contexts/1/edit.
-
#index ⇒ Object
GET /contexts.
-
#new ⇒ Object
GET /contexts/new.
-
#show ⇒ Object
GET /contexts/1.
-
#update ⇒ Object
PATCH/PUT /contexts/1.
Instance Method Details
#create ⇒ Object
POST /contexts
28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/contexts_controller.rb', line 28 def create self.context = current_organization.contexts.new(context_params) if context.save logger.info "Created #{context}" redirect_to [current_organization,context], notice: 'Context was successfully created.' else logger.warn "Unable to create context: '#{context.error_sentence}'" render :new end end |
#destroy ⇒ Object
DELETE /contexts/1
51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/contexts_controller.rb', line 51 def destroy if context.destroy flash[:notice] = 'Context was successfully destroyed.' else msg = "Unable to destroy #{context}: #{context.error_sentence}" logger.warn msg flash[:error] = msg end redirect_to organization_contexts_url(current_organization) end |
#edit ⇒ Object
GET /contexts/1/edit
24 25 |
# File 'app/controllers/contexts_controller.rb', line 24 def edit end |
#index ⇒ Object
GET /contexts
11 12 |
# File 'app/controllers/contexts_controller.rb', line 11 def index end |
#new ⇒ Object
GET /contexts/new
19 20 21 |
# File 'app/controllers/contexts_controller.rb', line 19 def new self.context = current_organization.contexts.new end |
#show ⇒ Object
GET /contexts/1
15 16 |
# File 'app/controllers/contexts_controller.rb', line 15 def show end |
#update ⇒ Object
PATCH/PUT /contexts/1
41 42 43 44 45 46 47 48 |
# File 'app/controllers/contexts_controller.rb', line 41 def update if context.update(context_params) redirect_to [current_organization,context], notice: 'Context was successfully updated.' else logger.warn "Unable to update #{context}: #{context.error_sentence}" render :edit end end |