Module: HalApi::Controller::Actions

Included in:
HalApi::Controller
Defined in:
lib/hal_api/controller/actions.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#createObject



10
11
12
13
14
15
16
17
# File 'lib/hal_api/controller/actions.rb', line 10

def create
  create_resource.tap do |res|
    consume_with_content_type! res
    hal_authorize res
    res.save!
    respond_with root_resource(res), show_options
  end
end

#destroyObject



28
29
30
31
32
33
34
# File 'lib/hal_api/controller/actions.rb', line 28

def destroy
  destroy_resource.tap do |res|
    hal_authorize res
    res.destroy
    head :no_content
  end
end

#indexObject



2
3
4
# File 'lib/hal_api/controller/actions.rb', line 2

def index
  respond_with index_collection, index_options
end

#showObject



6
7
8
# File 'lib/hal_api/controller/actions.rb', line 6

def show
  respond_with root_resource(show_resource), show_options
end

#updateObject



19
20
21
22
23
24
25
26
# File 'lib/hal_api/controller/actions.rb', line 19

def update
  update_resource.tap do |res|
    consume_with_content_type! res
    hal_authorize res
    res.save!
    respond_with root_resource(res), show_options
  end
end