From 33a44fc470c42a019607aaedac1e722b77af8667 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Tue, 19 Jul 2016 13:49:00 +0200 Subject: [PATCH] uses a module to structure controller code --- app/controllers/budgets/budgets_controller.rb | 9 +++++++++ .../{budget => budgets}/investments_controller.rb | 2 +- app/views/budgets/budgets/index.html.erb | 1 + app/views/{budget => budgets}/investments/index.html.erb | 0 config/routes.rb | 6 ++++-- 5 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 app/controllers/budgets/budgets_controller.rb rename app/controllers/{budget => budgets}/investments_controller.rb (86%) create mode 100644 app/views/budgets/budgets/index.html.erb rename app/views/{budget => budgets}/investments/index.html.erb (100%) diff --git a/app/controllers/budgets/budgets_controller.rb b/app/controllers/budgets/budgets_controller.rb new file mode 100644 index 000000000..c42bf999d --- /dev/null +++ b/app/controllers/budgets/budgets_controller.rb @@ -0,0 +1,9 @@ +module Budgets + class BudgetsController < ApplicationController + skip_authorization_check + + def index + end + + end +end \ No newline at end of file diff --git a/app/controllers/budget/investments_controller.rb b/app/controllers/budgets/investments_controller.rb similarity index 86% rename from app/controllers/budget/investments_controller.rb rename to app/controllers/budgets/investments_controller.rb index b1e1ff16e..f86b1ea2b 100644 --- a/app/controllers/budget/investments_controller.rb +++ b/app/controllers/budgets/investments_controller.rb @@ -1,4 +1,4 @@ -class Budget +module Budgets class InvestmentsController < ApplicationController skip_authorization_check diff --git a/app/views/budgets/budgets/index.html.erb b/app/views/budgets/budgets/index.html.erb new file mode 100644 index 000000000..971274630 --- /dev/null +++ b/app/views/budgets/budgets/index.html.erb @@ -0,0 +1 @@ +budgets index \ No newline at end of file diff --git a/app/views/budget/investments/index.html.erb b/app/views/budgets/investments/index.html.erb similarity index 100% rename from app/views/budget/investments/index.html.erb rename to app/views/budgets/investments/index.html.erb diff --git a/config/routes.rb b/config/routes.rb index 7b0d825c4..fdc2593ba 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -75,8 +75,10 @@ Rails.application.routes.draw do end end - namespace :budget do - resources :investments, only: [:index] + scope module: :budgets do + resources :budgets do + resources :investments, only: [:index] + end end resources :stats, only: [:index]