Class: PrototypesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/prototypes_controller.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) create



12
13
14
15
16
17
18
# File 'app/controllers/prototypes_controller.rb', line 12

def create
  if @prototype.save
    render json: @prototype, status: :created
  else
    render json: { errors: @prototype.errors }, status: :unprocessable_entity
  end
end

- (Object) index



8
9
10
# File 'app/controllers/prototypes_controller.rb', line 8

def index
  render json: @prototypes, status: :ok
end

- (Object) show



20
21
22
# File 'app/controllers/prototypes_controller.rb', line 20

def show
  render json: @prototype, status: :ok
end

- (Object) update



24
25
26
27
# File 'app/controllers/prototypes_controller.rb', line 24

def update
  @prototype.update_attributes(prototype_params)
  render json: @prototype, status: :ok
end