From: yasushiito Date: Sun, 30 Sep 2012 02:47:18 +0000 (+0900) Subject: t#29704:run mode flag move to magic number X-Git-Url: http://git.osdn.net/view?p=pettanr%2Fpettanr.git;a=commitdiff_plain;h=dbc4c55156740f7a88c36bfa765f2e273846f74d t#29704:run mode flag move to magic number --- diff --git a/app/controllers/comics_controller.rb b/app/controllers/comics_controller.rb index 3eda75eb..41073259 100644 --- a/app/controllers/comics_controller.rb +++ b/app/controllers/comics_controller.rb @@ -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] diff --git a/app/controllers/stories_controller.rb b/app/controllers/stories_controller.rb index c3fc902c..c8b710ce 100644 --- a/app/controllers/stories_controller.rb +++ b/app/controllers/stories_controller.rb @@ -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] diff --git a/config/initializers/constants.rb b/config/initializers/constants.rb index e32ea47a..6ad1c72e 100644 --- a/config/initializers/constants.rb +++ b/config/initializers/constants.rb @@ -1,5 +1,3 @@ class Const - cattr_accessor :run_mode - @@run_mode = 1 end diff --git a/config/magic_number.yml b/config/magic_number.yml index b551a62e..7412f3f3 100644 --- a/config/magic_number.yml +++ b/config/magic_number.yml @@ -1,2 +1,4 @@ + run_mode: 1 + thumbnail_width: 64 thumbnail_height: 64