Class: Admin::BaitLibrariesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/admin/bait_libraries_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/admin/bait_libraries_controller.rb', line 21

def create
  @bait_library = BaitLibrary.new(params[:bait_library])

  respond_to do |format|
    if @bait_library.save
      flash[:notice] = 'Bait Library was successfully created.'
      format.html { redirect_to(admin_bait_libraries_path) }
    else
      format.html { render action: 'new' }
    end
  end
end

#destroyObject


45
46
47
48
49
50
51
52
# File 'app/controllers/admin/bait_libraries_controller.rb', line 45

def destroy
  respond_to do |format|
    if @bait_library.hide
      flash[:notice] = 'Bait Library was successfully deleted.'
    end
    format.html { redirect_to(admin_bait_libraries_path) }
  end
end

#editObject


18
19
# File 'app/controllers/admin/bait_libraries_controller.rb', line 18

def edit
end

#indexObject


8
9
10
11
12
# File 'app/controllers/admin/bait_libraries_controller.rb', line 8

def index
  @bait_libraries = BaitLibrary.visible
  @bait_library_types = BaitLibraryType.visible
  @bait_library_suppliers = BaitLibrary::Supplier.visible
end

#newObject


14
15
16
# File 'app/controllers/admin/bait_libraries_controller.rb', line 14

def new
  @bait_library = BaitLibrary.new
end

#updateObject


34
35
36
37
38
39
40
41
42
43
# File 'app/controllers/admin/bait_libraries_controller.rb', line 34

def update
  respond_to do |format|
    if @bait_library.update(params[:bait_library])
      flash[:notice] = 'Bait Library was successfully updated.'
      format.html { redirect_to(admin_bait_libraries_path) }
    else
      format.html { render action: 'edit' }
    end
  end
end