OSDN Git Service

t#29704:run mode flag move to magic number
authoryasushiito <yas@pen-chan.jp>
Sun, 30 Sep 2012 02:47:18 +0000 (11:47 +0900)
committeryasushiito <yas@pen-chan.jp>
Sun, 30 Sep 2012 02:47:18 +0000 (11:47 +0900)
app/controllers/comics_controller.rb
app/controllers/stories_controller.rb
config/initializers/constants.rb
config/magic_number.yml

index 3eda75e..4107325 100644 (file)
@@ -1,6 +1,6 @@
 class ComicsController < ApplicationController
   layout 'test' if Pettanr::Application.test_layout
-  if Const.run_mode == 0
+  if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user!, :only => [:new, :create, :edit, :update, :destroy]
   else
     before_filter :authenticate_user!, :only => [:top, :index, :show, :play, :new, :create, :edit, :update, :destroy]
index c3fc902..c8b710c 100644 (file)
@@ -1,6 +1,6 @@
 class StoriesController < ApplicationController
   layout 'test' if Pettanr::Application.test_layout
-  if Const.run_mode == 0
+  if MagicNumber['run_mode'] == 0
     before_filter :authenticate_user!, :only => [:new, :create, :edit, :update, :destroy]
   else
     before_filter :authenticate_user!, :only => [:index, :show, :comic, :new, :create, :edit, :update, :destroy]
index e32ea47..6ad1c72 100644 (file)
@@ -1,5 +1,3 @@
 class Const
-  cattr_accessor :run_mode
-  @@run_mode = 1
 end
 
index b551a62..7412f3f 100644 (file)
@@ -1,2 +1,4 @@
+  run_mode: 1
+
   thumbnail_width: 64
   thumbnail_height: 64