Class: Kms::TemplatesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Kms::TemplatesController
- Defined in:
- app/controllers/kms/templates_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'app/controllers/kms/templates_controller.rb', line 8 def create @template = Template.new(template_params) if @template.save render json: @template.to_json else render json: @template.to_json(methods: :errors), status: :unprocessable_entity end end |
#destroy ⇒ Object
31 32 33 34 35 |
# File 'app/controllers/kms/templates_controller.rb', line 31 def destroy @template = Template.find(params[:id]) @template.destroy render json: @template.to_json end |
#index ⇒ Object
4 5 6 |
# File 'app/controllers/kms/templates_controller.rb', line 4 def index render json: Template.all.to_json end |
#show ⇒ Object
26 27 28 29 |
# File 'app/controllers/kms/templates_controller.rb', line 26 def show @template = Template.find(params[:id]) render json: @template.to_json end |
#update ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'app/controllers/kms/templates_controller.rb', line 17 def update @template = Template.find(params[:id]) if @template.update_attributes(template_params) render json: @template.to_json else render json: @template.to_json(methods: :errors), status: :unprocessable_entity end end |