Class: FrontEndBuilds::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- FrontEndBuilds::ApplicationController
- Defined in:
- app/controllers/front_end_builds/application_controller.rb
Direct Known Subclasses
AdminController, AppsController, BestsController, BuildsController, HostAppsController, PubkeysController
Instance Method Summary collapse
- #error!(errors, status = :unprocessable_entity) ⇒ Object
-
#respond_with_json(object, options = {}) ⇒ Object
Public: A quick helper to create a respond_to block for returning json to the client.
Instance Method Details
#error!(errors, status = :unprocessable_entity) ⇒ Object
15 16 17 |
# File 'app/controllers/front_end_builds/application_controller.rb', line 15 def error!(errors, status = :unprocessable_entity) respond_with_json({ errors: errors }, status: status) end |
#respond_with_json(object, options = {}) ⇒ Object
Public: A quick helper to create a respond_to block for returning json to the client. Used because ‘respond_with` is no longer included in Rails.
7 8 9 10 11 12 13 |
# File 'app/controllers/front_end_builds/application_controller.rb', line 7 def respond_with_json(object, = {}) respond_to do |format| format.json do render .merge(json: object) end end end |