Class: Gaggle::GoosesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/gaggle/gooses_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
# File 'app/controllers/gaggle/gooses_controller.rb', line 13

def create
  @goose.assign_attributes(goose_params)
  if @goose.save
    redirect_to @goose, notice: "Goose was successfully created."
  else
    render :new
  end
end

#destroyObject



32
33
34
35
# File 'app/controllers/gaggle/gooses_controller.rb', line 32

def destroy
  @goose.destroy
  redirect_to root_url, notice: "Goose was successfully destroyed."
end

#editObject



22
# File 'app/controllers/gaggle/gooses_controller.rb', line 22

def edit; end

#indexObject



5
6
7
# File 'app/controllers/gaggle/gooses_controller.rb', line 5

def index
  @gooses = Goose.where.not(id: Current.goose_user&.id)
end

#newObject



11
# File 'app/controllers/gaggle/gooses_controller.rb', line 11

def new; end

#showObject



9
# File 'app/controllers/gaggle/gooses_controller.rb', line 9

def show; end

#updateObject



24
25
26
27
28
29
30
# File 'app/controllers/gaggle/gooses_controller.rb', line 24

def update
  if @goose.update(goose_params)
    redirect_to @goose, notice: "Goose was successfully updated."
  else
    render :edit
  end
end