Class: Upframework::ResourcesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/upframework/resources_controller.rb

Instance Method Summary collapse

Instance Method Details

#create ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'app/controllers/upframework/resources_controller.rb', line 28

def create
  if base_resource.save

    yield if block_given?
    render_serialized base_resource, params
  else
    render_errors base_resource.errors.full_messages
  end
end

#destroy ⇒ Object



38
39
40
41
# File 'app/controllers/upframework/resources_controller.rb', line 38

def destroy
  base_resource.destroy
  head :no_content
end

#index ⇒ Object



21
22
23
24
25
26
# File 'app/controllers/upframework/resources_controller.rb', line 21

def index
  base_resource

  yield if block_given?
  render_serialized base_resource, params
end

#show ⇒ Object



5
6
7
8
9
10
# File 'app/controllers/upframework/resources_controller.rb', line 5

def show
  base_resource

  yield if block_given?
  render_serialized base_resource, params
end

#update ⇒ Object



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

def update
  if base_resource.update(base_resource_params)
    yield if block_given?
    render_serialized base_resource, params
  else
    render_errors base_resource.errors.full_messages
  end
end