Class: IWonder::MetricsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- IWonder::MetricsController
- Defined in:
- app/controllers/i_wonder/metrics_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
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 |
#destroy ⇒ Object
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 |
#edit ⇒ Object
31 32 33 34 |
# File 'app/controllers/i_wonder/metrics_controller.rb', line 31 def edit @metric = Metric.find(params[:id]) render "edit" end |
#index ⇒ Object
9 10 11 |
# File 'app/controllers/i_wonder/metrics_controller.rb', line 9 def index @metrics = Metric.all end |
#new ⇒ Object
17 18 19 |
# File 'app/controllers/i_wonder/metrics_controller.rb', line 17 def new @metric = Metric.new(params[:metric]) end |
#show ⇒ Object
13 14 15 |
# File 'app/controllers/i_wonder/metrics_controller.rb', line 13 def show @metric = Metric.find(params[:id]) end |
#update ⇒ Object
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 |