Class: IWonder::MetricsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/i_wonder/metrics_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



21
22
23
24
25
26
27
28
29
# File 'app/controllers/i_wonder/metrics_controller.rb', line 21

def create
  @metric = Metric.new(params[:metric])

  if @metric.save
    redirect_to @metric, :notice => "Successfully created metric"
  else
    render "new"
  end
end

#destroyObject



46
47
48
49
50
# File 'app/controllers/i_wonder/metrics_controller.rb', line 46

def destroy
  @metric = Metric.find(params[:id])
  @metric.destroy
  redirect_to metrics_path, :notice => "Metric has been destroyed"
end

#editObject



31
32
33
34
# File 'app/controllers/i_wonder/metrics_controller.rb', line 31

def edit
  @metric = Metric.find(params[:id])
  render "edit"
end

#indexObject



9
10
11
# File 'app/controllers/i_wonder/metrics_controller.rb', line 9

def index
  @metrics = Metric.all
end

#newObject



17
18
19
# File 'app/controllers/i_wonder/metrics_controller.rb', line 17

def new
  @metric = Metric.new(params[:metric])
end

#showObject



13
14
15
# File 'app/controllers/i_wonder/metrics_controller.rb', line 13

def show
  @metric = Metric.find(params[:id])
end

#updateObject



36
37
38
39
40
41
42
43
44
# File 'app/controllers/i_wonder/metrics_controller.rb', line 36

def update
  @metric = Metric.find(params[:id])

  if @metric.update_attributes(params[:metric])
    redirect_to @metric, :notice => "Successfully updated metric"
  else
    render "edit"
  end
end