Module: ResourcesController::RestActions

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
app/concerns/resources_controller/rest_actions.rb

Instance Method Summary collapse

Instance Method Details

#createObject


47
48
49
50
51
52
53
# File 'app/concerns/resources_controller/rest_actions.rb', line 47

def create
  if @resource.save && respond_to?(:after_create_location, true) && after_create_location.present?
    respond_with(respond_with_namespace, @resource, location: after_create_location)
  else
    respond_with(respond_with_namespace, @resource)
  end
end

#destroyObject


38
39
40
41
42
43
44
45
# File 'app/concerns/resources_controller/rest_actions.rb', line 38

def destroy
  @resource.destroy
  if respond_to?(:after_destroy_location, true) && after_create_location.present?
    respond_with(respond_with_namespace, @resource, location: after_destroy_location)
  else
    respond_with(respond_with_namespace, @resource)
  end
end

#editObject


28
# File 'app/concerns/resources_controller/rest_actions.rb', line 28

def edit; end

#indexObject


25
# File 'app/concerns/resources_controller/rest_actions.rb', line 25

def index; end

#newObject


26
# File 'app/concerns/resources_controller/rest_actions.rb', line 26

def new; end

#showObject


27
# File 'app/concerns/resources_controller/rest_actions.rb', line 27

def show; end

#updateObject


30
31
32
33
34
35
36
# File 'app/concerns/resources_controller/rest_actions.rb', line 30

def update
  if @resource.send(update_method_name, permitted_params) && respond_to?(:after_update_location, true) && after_update_location.present?
    respond_with(respond_with_namespace, @resource, location: after_update_location)
  else
    respond_with(respond_with_namespace, @resource)
  end
end