Class: Prosperity::DashboardsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Prosperity::DashboardsController
- Defined in:
- app/controllers/prosperity/dashboards_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/prosperity/dashboards_controller.rb', line 21 def create @dashboard = Dashboard.new @dashboard.title = params.fetch(:dashboard, {})[:title] @dashboard.default = false if @dashboard.save redirect_to edit_dashboard_path(@dashboard) else flash[:error] = @dashboard.errors..to_sentence render action: :new end end |
#destroy ⇒ Object
33 34 35 36 |
# File 'app/controllers/prosperity/dashboards_controller.rb', line 33 def destroy dashboard.destroy redirect_to action: 'index' end |
#edit ⇒ Object
17 18 19 |
# File 'app/controllers/prosperity/dashboards_controller.rb', line 17 def edit dashboard end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/prosperity/dashboards_controller.rb', line 5 def index @dashboards = Dashboard.all end |
#new ⇒ Object
9 10 11 |
# File 'app/controllers/prosperity/dashboards_controller.rb', line 9 def new @dashboard = Dashboard.new end |
#show ⇒ Object
13 14 15 |
# File 'app/controllers/prosperity/dashboards_controller.rb', line 13 def show dashboard end |