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



50
51
52
53
54
55
56
57
# File 'app/concerns/resources_controller/rest_actions.rb', line 50

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

#destroyObject



41
42
43
44
45
46
47
48
# File 'app/concerns/resources_controller/rest_actions.rb', line 41

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

#editObject



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

def edit; end

#indexObject



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

def index; end

#newObject



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

def new; end

#showObject



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

def show; end

#updateObject



28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/concerns/resources_controller/rest_actions.rb', line 28

def update
  if Rails::VERSION::MAJOR < 4
    @resource.update_attributes(permitted_params)
  else
    @resource.update(permitted_params)
  end
  if respond_to?(:after_update_location, true)
    respond_with(respond_with_namespace, @resource, location: after_update_location)
  else
    respond_with(respond_with_namespace, @resource)
  end
end