Class: Naf::LoggerStylesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/naf/logger_styles_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



27
28
29
30
31
32
33
34
35
# File 'app/controllers/naf/logger_styles_controller.rb', line 27

def create
  @logger_style = Naf::LoggerStyle.new(params[:logger_style])
  if @logger_style.save
    redirect_to(@logger_style,
                notice: "Logger Style '#{@logger_style.name}' was successfully created.")
  else
    render action: "new"
  end
end

#destroyObject



15
16
17
18
19
20
# File 'app/controllers/naf/logger_styles_controller.rb', line 15

def destroy
  @logger_style = Naf::LoggerStyle.find(params[:id])
  @logger_style.destroy
  flash[:notice] = "Logger Style '#{@logger_style.name}' was successfully deleted."
  redirect_to(action: "index")
end

#editObject



37
38
39
# File 'app/controllers/naf/logger_styles_controller.rb', line 37

def edit
  @logger_style = Naf::LoggerStyle.find(params[:id])
end

#indexObject



6
7
8
9
# File 'app/controllers/naf/logger_styles_controller.rb', line 6

def index
  @rows = Naf::LoggerStyle.all
  render template: 'naf/datatable'
end

#newObject



22
23
24
25
# File 'app/controllers/naf/logger_styles_controller.rb', line 22

def new
  @logger_style = Naf::LoggerStyle.new
  @logger_style.logger_style_names.build
end

#showObject



11
12
13
# File 'app/controllers/naf/logger_styles_controller.rb', line 11

def show
  @logger_style = Naf::LoggerStyle.find(params[:id])
end

#updateObject



41
42
43
44
45
46
47
48
49
# File 'app/controllers/naf/logger_styles_controller.rb', line 41

def update
  @logger_style = Naf::LoggerStyle.find(params[:id])
  if @logger_style.update_attributes(params[:logger_style])
    redirect_to(@logger_style,
                notice: "Logger Style '#{@logger_style.name}' was successfully updated.")
  else
    render action: "edit"
  end
end