diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2015-03-04 11:02:24 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2015-03-04 11:02:24 -0800 |
commit | c2108926a4638b5373f846c2d6165bf28108b9cb (patch) | |
tree | c953bb2bfc56aa0b3453e7a6d6a8febc49e89dba /actionpack/lib/action_dispatch | |
parent | 154d60c8ce6863c6466de22efceccb6f104a89ae (diff) | |
download | rails-c2108926a4638b5373f846c2d6165bf28108b9cb.tar.gz rails-c2108926a4638b5373f846c2d6165bf28108b9cb.tar.bz2 rails-c2108926a4638b5373f846c2d6165bf28108b9cb.zip |
Drop request class from RouteSet constructor.
If you would like to use a custom request class, please subclass and implemet
the `request_class` method.
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 29853a3474..6d964c2cbf 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -311,7 +311,7 @@ module ActionDispatch attr_accessor :formatter, :set, :named_routes, :default_scope, :router attr_accessor :disable_clear_and_finalize, :resources_path_names - attr_accessor :default_url_options, :request_class + attr_accessor :default_url_options attr_reader :env_key alias :routes :set @@ -320,11 +320,10 @@ module ActionDispatch { :new => 'new', :edit => 'edit' } end - def initialize(request_class = ActionDispatch::Request) + def initialize self.named_routes = NamedRouteCollection.new self.resources_path_names = self.class.default_resources_path_names self.default_url_options = {} - self.request_class = request_class @append = [] @prepend = [] @@ -337,6 +336,10 @@ module ActionDispatch @formatter = Journey::Formatter.new @set end + def request_class + ActionDispatch::Request + end + def draw(&block) clear! unless @disable_clear_and_finalize eval_block(block) @@ -545,7 +548,7 @@ module ActionDispatch conditions.keep_if do |k, _| k == :action || k == :controller || k == :required_defaults || - @request_class.public_method_defined?(k) || path_values.include?(k) + request_class.public_method_defined?(k) || path_values.include?(k) end end private :build_conditions |