Class: Selections::SelectionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/selections/selections_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



19
20
21
22
23
24
25
26
# File 'app/controllers/selections/selections_controller.rb', line 19

def create
  @selection = Selection.new(params[:selection])
  if @selection.save
    redirect_to @selection, notice: 'Selection was successfully created.'
  else
    render action: "new"
  end
end

#destroyObject



38
39
40
41
42
43
# File 'app/controllers/selections/selections_controller.rb', line 38

def destroy
  @selection = Selection.find(params[:id])
  @selection.destroy

  redirect_to selections_url
end

#editObject



15
16
17
# File 'app/controllers/selections/selections_controller.rb', line 15

def edit
  @selection = Selection.find(params[:id])
end

#indexObject



3
4
5
# File 'app/controllers/selections/selections_controller.rb', line 3

def index
  @selections = Selection.all
end

#newObject



11
12
13
# File 'app/controllers/selections/selections_controller.rb', line 11

def new
  @selection = Selection.new
end

#showObject



7
8
9
# File 'app/controllers/selections/selections_controller.rb', line 7

def show
  @selection = Selection.find(params[:id])
end

#updateObject



28
29
30
31
32
33
34
35
36
# File 'app/controllers/selections/selections_controller.rb', line 28

def update
  @selection = Selection.find(params[:id])

  if @selection.update_attributes(params[:selection])
    redirect_to @selection, notice: 'Selection was successfully updated.'
  else
    render action: "edit"
  end
end