diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2011-07-12 14:36:55 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2011-07-12 14:36:55 +0100 |
commit | 8ca2f1fca08b8d645040bba2d83b77a889067b23 (patch) | |
tree | 9fe956d70154e4c162454e099a331f4e0386293e /app/controllers/request_controller.rb | |
parent | 15973386cb4f412cf439414ef908d4594c897f24 (diff) |
Refactor custom states loading (use class methods where appropriate, simplify main code at the cost (small) of test legibility)
Diffstat (limited to 'app/controllers/request_controller.rb')
-rw-r--r-- | app/controllers/request_controller.rb | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index b339134eb..44e4880c2 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -12,25 +12,13 @@ class RequestController < ApplicationController before_filter :check_read_only, :only => [ :new, :show_response, :describe_state, :upload_response ] protect_from_forgery :only => [ :new, :show_response, :describe_state, :upload_response ] # See ActionController::RequestForgeryProtection for details - def load_custom_states - @@custom_states_loaded = false + @@custom_states_loaded = false + begin if !ENV["RAILS_ENV"] == "test" - load_custom_states! - end - end - - def load_custom_states! - begin - # InfoRequestCustomStates may be `require`d in a theme - # plugin, or by a test - RequestController.send(:include, RequestControllerCustomStates) + include RequestControllerCustomStates @@custom_states_loaded = true - rescue NameError end - end - - def initialize - self.load_custom_states + rescue NameError end def show |