Module: Controller::RestActionsConcern

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/concerns/controller/rest_actions_concern.rb

Instance Method Summary collapse

Instance Method Details

#createObject



22
23
24
25
26
# File 'app/controllers/concerns/controller/rest_actions_concern.rb', line 22

def create
  @resource = resource_class.new(permitted_params)
  @resource.save
  respond_with @resource, location: collection_path
end

#destroyObject



44
45
46
47
48
# File 'app/controllers/concerns/controller/rest_actions_concern.rb', line 44

def destroy
  @resource = load_resource
  @resource.destroy
  respond_with @resource, location: collection_path
end

#editObject



33
34
35
36
# File 'app/controllers/concerns/controller/rest_actions_concern.rb', line 33

def edit
  @resource = load_resource
  respond_with @resource
end

#indexObject



12
13
14
15
# File 'app/controllers/concerns/controller/rest_actions_concern.rb', line 12

def index
  @collection = load_collection
  respond_with @collection
end

#newObject



17
18
19
20
# File 'app/controllers/concerns/controller/rest_actions_concern.rb', line 17

def new
  @resource = initialize_resource
  respond_with @resource
end

#showObject



28
29
30
31
# File 'app/controllers/concerns/controller/rest_actions_concern.rb', line 28

def show
  @resource = load_resource
  respond_with @resource
end

#updateObject



38
39
40
41
42
# File 'app/controllers/concerns/controller/rest_actions_concern.rb', line 38

def update
  @resource = load_resource
  @resource.update_attributes(permitted_params)
  respond_with @resource, location: collection_path
end