Class: Phaseout::PhaseoutController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Phaseout::PhaseoutController
- Defined in:
- app/controllers/phaseout/phaseout_controller.rb
Instance Method Summary collapse
Instance Method Details
#action_keys ⇒ Object
33 34 35 36 37 38 39 |
# File 'app/controllers/phaseout/phaseout_controller.rb', line 33 def action_keys streamed_json_response do |stream| ::Phaseout::SEOFields.all(params[:key]) do |fields| stream.call fields end end end |
#actions ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/controllers/phaseout/phaseout_controller.rb', line 25 def actions streamed_json_response do |stream| ::Phaseout::SEOAction.all do |seo_action| stream.call seo_action end end end |
#delete ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/phaseout/phaseout_controller.rb', line 15 def delete @seo_fields = Phaseout::SEOFields.find params[:key] if @seo_fields @seo_fields.delete render json: { status: :ok }.to_json else not_found end end |
#update ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'app/controllers/phaseout/phaseout_controller.rb', line 4 def update @seo_fields = Phaseout::SEOFields.find params[:key] if @seo_fields @seo_fields.values = params[:seo_field].to_h.symbolize_keys @seo_fields.save render json: @seo_fields.to_json else not_found end end |