Module: Api::ResourcesController::Base::FirstAction

Extended by:
ActiveSupport::Concern
Included in:
Api::ResourcesController::Base
Defined in:
app/controllers/api/resources_controller/base.rb

Instance Method Summary collapse

Instance Method Details

#firstObject


260
261
262
263
264
265
266
267
268
# File 'app/controllers/api/resources_controller/base.rb', line 260

def first
  respond_to do |format|
    if @resource.nil?
      format.json { render json: nil }
    else
      format.json { render json: [serialize_resource(@resource)] }
    end
  end
end