Module: Api::ResourcesController::Base::LastAction

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

#lastObject


290
291
292
293
294
295
296
297
298
# File 'app/controllers/api/resources_controller/base.rb', line 290

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