Class: Droom::Api::EventsController

Inherits:
ApiController show all
Defined in:
app/controllers/droom/api/events_controller.rb

Instance Method Summary collapse

Methods inherited from ApiController

#current_ability

Methods inherited from EngineController

#current_ability

Instance Method Details

#createObject



21
22
23
24
25
26
27
28
29
# File 'app/controllers/droom/api/events_controller.rb', line 21

def create
  if @event && @event.persisted?
    render json: @event
  else
    render json: {
      errors: @event.errors.to_a
    }
  end
end

#destroyObject



31
32
33
34
# File 'app/controllers/droom/api/events_controller.rb', line 31

def destroy
  @event.destroy
  head :ok
end

#indexObject



8
9
10
# File 'app/controllers/droom/api/events_controller.rb', line 8

def index
  render json: @events
end

#showObject



12
13
14
# File 'app/controllers/droom/api/events_controller.rb', line 12

def show
  render json: @event
end

#updateObject



16
17
18
19
# File 'app/controllers/droom/api/events_controller.rb', line 16

def update
  @event.update_attributes(event_params)
  render json: @event
end