Class: Spina::Api::ResourcesController

Inherits:
ApiController
  • Object
show all
Includes:
Paginable
Defined in:
app/controllers/spina/api/resources_controller.rb

Constant Summary

Constants inherited from ApiController

ApiController::TOKEN

Instance Method Summary collapse

Instance Method Details

#indexObject



6
7
8
9
# File 'app/controllers/spina/api/resources_controller.rb', line 6

def index
  resources = Resource.order(:id)
  render json: Spina::Api::ResourceSerializer.new(*pagination(resources)).serializable_hash.to_json
end

#showObject



11
12
13
14
# File 'app/controllers/spina/api/resources_controller.rb', line 11

def show
  @resource = Resource.find(params[:id])
  render json: Spina::Api::ResourceSerializer.new(@resource).serializable_hash.to_json
end