Class: Releasable::ReleasesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/releasable/releases_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
23
# File 'app/controllers/releasable/releases_controller.rb', line 15

def create
  @release = Release.new(release_params)

  if @release.save
    redirect_to releases_path, notice: "Release #{@release.key} has been created"
  else
    render :new
  end
end

#destroyObject



35
36
37
38
39
40
# File 'app/controllers/releasable/releases_controller.rb', line 35

def destroy
  @release = retrieve_release
  @release.destroy

  redirect_to releases_path, notice: "Release #{@release.key} has been deleted"
end

#editObject



11
12
13
# File 'app/controllers/releasable/releases_controller.rb', line 11

def edit
  @release = retrieve_release
end

#indexObject



3
4
5
# File 'app/controllers/releasable/releases_controller.rb', line 3

def index
  @releases = Release.all
end

#newObject



7
8
9
# File 'app/controllers/releasable/releases_controller.rb', line 7

def new
  @release = Release.new
end

#updateObject



25
26
27
28
29
30
31
32
33
# File 'app/controllers/releasable/releases_controller.rb', line 25

def update
  @release = retrieve_release

  if @release.update(release_params)
    redirect_to releases_path, notice: "Release #{@release.key} has been updated"
  else
    render :edit
  end
end