This project is archived and is in readonly mode.

#4002 ✓resolved
Lenary

Subdomains constraits in routing don't work

Reported by Lenary | February 19th, 2010 @ 12:18 PM | in 3.0.2

Hi,

I checked the rack-mount issues (on github) and didn't find one relating to this, but i decided to open the ticket here.

In the last two days we have come across people in #railsbridge reporting problems with using :constraints => {:subdomain => "foo"} or something in routing.

This hasn't been working. i'll ask them to add some comments, but for the moment they're reporting that using a regular expression on the :host in :constraints is working.

Comments and changes to this ticket

  • Gregor Robert Russbuelt

    Gregor Robert Russbuelt February 19th, 2010 @ 12:38 PM

    Lenary, thanks for opening this ticket for me =)

    I am currently porting a Rails 2.3.5 App to 3.0.0beta1 and had some trouble with subdomains. I was using subdomain_fu back then.

    As Rails 3.0.0beta1 supports
    :constraints => {:subdomain => "foo"} I tried to use it for subdomain routing. But it failed.

    Yehuda Katz mentioned some ways to implement subdomain based routing in Rails 3.0.0beta1
    http://yehudakatz.com/2009/12/26/the-rails-3-router-rack-it-up/
    so I setup a Sandbox to test it.

    I came across two different errors:
    Edge::Application.routes.draw do
    match "/test", :to => "foo#show", :constraints => {:subdomain => "foo" } end

    RuntimeError
    route set not finalized

    And the following when using a regexp for (e.g. :subdomain => /.+/)

    ArgumentError
    conditions may only include [:env, :body, :scheme, :script_name, :path_info, :port, :request_method, :query_string, :content_length, :content_type, :session, :session_options, :logger, :media_type, :media_type_params, :content_charset, :host_with_port, :host, :script_name=, :path_info=, :get?, :post?, :put?, :delete?, :head?, :form_data?, :parseable_data?, :GET, :POST, :params, :[], :[]=, :values_at, :referer, :referrer, :user_agent, :cookies, :xhr?, :url, :path, :fullpath, :accept_encoding, :ip, :parse_query, :parse_multipart]

    My quick workaround right now:
    :contraints => {:host => /([a-zA-Z0-9]+.){2,}+/} or
    contraints(:host => /([a-zA-Z0-9]+.){2,}+/) do
    end

    Installed Gems:
    abstract (1.0.0)
    * actionmailer (3.0.0.beta1) * actionpack (3.0.0.beta1) * activemodel (3.0.0.beta1) * activerecord (3.0.0.beta1) * activeresource (3.0.0.beta1) * activesupport (3.0.0.beta1) * arel (0.2.1) * authlogic (2.1.3) * builder (2.1.2) * bundler (0.9.7) * compass (0.10.0.pre5) * erubis (2.6.5) * haml (2.2.20) * i18n (0.3.3) * mail (2.1.2) * memcache-client (1.7.8) * mime-types (1.16) * mysql (2.8.1) * rack (1.1.0) * rack-mount (0.5.2) * rack-test (0.5.3) * rails (3.0.0.beta1) * railties (3.0.0.beta1) * rake (0.8.7) * text-format (1.0.0) * text-hyphen (1.0.0) * thor (0.13.3) * tzinfo (0.3.16)

    Hope this helps =)

  • José Valim

    José Valim February 23rd, 2010 @ 09:32 PM

    • Assigned user set to “josh”
    • Milestone cleared.
  • josh

    josh February 24th, 2010 @ 01:58 AM

    • State changed from “new” to “wontfix”

    Request#subdomain does not exist so I'm not sure why its documented as a "feature".

    This isn't as simple as adding that method. Full url generation needs additional investigation.

  • josh
  • Gregor Robert Russbuelt

    Gregor Robert Russbuelt February 24th, 2010 @ 09:04 AM

    Joshua,
    thanks for investigating this.

    Isn't the Request#* object handled/provided by rack/rack-mount?

    This works:

      request.host #=> test.foo.bar.tld
      request.subdomains #=> test.foo
    

    Or is this something different?

  • Yehuda Katz (wycats)

    Yehuda Katz (wycats) February 27th, 2010 @ 05:35 PM

    • State changed from “wontfix” to “open”
  • josh
  • bug.odesk (at gmail)

    bug.odesk (at gmail) April 2nd, 2010 @ 04:39 PM

    Seems like it's not fixed.

    match 'path' => 'contoller#method', :as => 'path', :constraints => {:subdomain => "up"}

    rake routes gives error:


    Invoke routes (first_time) Invoke environment (first_time) ** Execute environment rake aborted!
    conditions may only include [:env, :body, :scheme, :script_name, :path_info, :port, :request_method, :query_string, :content_length, :content_type, :session, :session_options, :logger, :media_type, :media_type_params, :content_charset, :host_with_port, :host, :script_name=, :path_info=, :get?, :post?, :put?, :delete?, :head?, :form_data?, :parseable_data?, :GET, :POST, :params, :[], :[]=, :values_at, :referer, :referrer, :user_agent, :cookies, :xhr?, :url, :path, :fullpath, :accept_encoding, :ip, :taguri=, :taguri, :to_yaml_style, :to_yaml_properties, :to_yaml, :duplicable?, :acts_like?, :blank?, :present?, :presence, :singleton_class, :class_eval, :html_safe?, :with_options, :to_param, :try, :instance_values, :instance_variable_names, :copy_instance_variables_from, :to_json, :as_json, :returning, :is_haml?, :
    , :to_query, :subclasses_of, :to_sql, :equality_predicate_sql, :bind, :find_correlate_in, :let, :require_or_load, :require_dependency, :require_association, :load_dependency, :load, :require, :unloadable, :nil?, :===, :=~, :!~, :eql?, :class, :clone, :dup, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :to_s, :inspect, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :extend, :display, :method, :public_method, :define_singleton_method, :hash, :__id__, :object_id, :to_enum, :enum_for, :gem, :silence_warnings, :enable_warnings, :with_warnings, :silence_stderr, :silence_stream, :suppress, :j, :jj, :JSON, :require_library_or_gem, :debugger, :breakpoint, :==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__]<br/> /opt/local/lib/ruby1.9/gems/1.9.1/gems/rack-mount-0.6.1/lib/rack/mount/route_set.rb:142:invalidate_conditions!' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rack-mount-0.6.1/lib/rack/mount/route_set.rb:52:in add_route' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rack-mount-0.6.1/lib/rack/mount/generation/route_set.rb:17:inadd_route' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rack-mount-0.6.1/lib/rack/mount/recognition/route_set.rb:19:in add_route' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/routing/route_set.rb:278:inadd_route' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/routing/mapper.rb:193:in match' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/routing/mapper.rb:330:inmatch' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/routing/mapper.rb:666:in match' /Users/user/projects/test/config/routes.rb:6:inblock in ' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/routing/route_set.rb:212:in instance_exec' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/routing/route_set.rb:212:indraw' /Users/user/Work/httpget/config/routes.rb:1:in <top (required)>' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:205:inload' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:205:in block in load' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:195:inblock in load_dependency' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:523:in new_constants_in' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:195:inload_dependency' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:205:in load' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/application/routes_reloader.rb:29:inblock in reload!' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/application/routes_reloader.rb:29:in each' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/application/routes_reloader.rb:29:inreload!' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/application/routes_reloader.rb:41:in reload_if_changed' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/railtie.rb:14:inblock (2 levels) in <class:Railtie>' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/callbacks.rb:438:in _run_prepare_callbacks' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/callbacks.rb:88:inrun_callbacks' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/callbacks.rb:40:in initialize' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/stack.rb:74:innew' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/stack.rb:74:in build' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/stack.rb:130:inblock in build' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/stack.rb:130:in each' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/stack.rb:130:ininject' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/stack.rb:130:in build' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/application.rb:127:inapp' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/application/finisher.rb:31:in block in <module:Finisher>' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/initializable.rb:25:ininstance_exec' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/initializable.rb:25:in run' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/initializable.rb:55:inblock in run_initializers' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/initializable.rb:54:in each' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/initializable.rb:54:inrun_initializers' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/application.rb:108:in initialize!' /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/application.rb:149:inblock in initialize_tasks' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in call' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:inblock in execute' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in each' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:inexecute' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:597:in block in invoke_with_call_chain' /opt/local/lib/ruby1.9/1.9.1/monitor.rb:190:inmon_synchronize' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:607:inblock in invoke_prerequisites' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:604:in each' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:604:ininvoke_prerequisites' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:596:in block in invoke_with_call_chain' /opt/local/lib/ruby1.9/1.9.1/monitor.rb:190:inmon_synchronize' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in invoke_with_call_chain' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:583:ininvoke' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2051:in invoke_task' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:inblock (2 levels) in top_level' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in each' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:inblock in top_level' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in standard_exception_handling' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2023:intop_level' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2001:in block in run' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:instandard_exception_handling' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:1998:in run' /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/bin/rake:31:in' /opt/local/bin/rake:19:in load' /opt/local/bin/rake:19:in'

    installed gems:

    abstract (1.0.0)
    actionmailer (3.0.0.beta)
    actionpack (3.0.0.beta)
    activemodel (3.0.0.beta)
    activerecord (3.0.0.beta)
    activeresource (3.0.0.beta)
    activesupport (3.0.0.beta)
    archive-tar-minitar (0.5.2)
    arel (0.3.3)
    builder (2.1.2)
    bundler (0.9.15)
    columnize (0.3.1)
    easy_roles (0.4.2)
    erubis (2.6.5)
    fastthread (1.0.7)
    formtastic (0.9.8)
    haml-edge (2.3.186)
    i18n (0.3.6)
    linecache19 (0.5.11)
    mail (2.1.5.3)
    memcache-client (1.8.1)
    mime-types (1.16)
    passenger (2.2.11)
    polyglot (0.3.1)
    rack (1.1.0)
    rack-mount (0.6.1)
    rack-test (0.5.3)
    rails (3.0.0.beta)
    rails3-generators (0.5.3)
    rails3b (3.0.1)
    railties (3.0.0.beta)
    rake (0.8.7)
    ruby-debug-base19 (0.11.23)
    ruby-debug19 (0.11.6)
    ruby_core_source (0.1.4)
    rubygems-update (1.3.6)
    text-format (1.0.0)
    text-hyphen (1.0.0)
    thor (0.13.4)
    treetop (1.4.5)
    tzinfo (0.3.18)

    Gemfile:

    source 'http://gemcutter.org'

    gem "rails", :git => "git://github.com/rails/rails.git"
    gem "haml-edge", :require => "haml"
    gem "rails3-generators"
    gem "simple_form", :git => "git://github.com/plataformatec/simple_form.git"
    gem "paperclip", :git => "git://github.com/JasonKing/paperclip.git", :branch => "rails3"
    gem "mysql"
    gem "easy_roles"
    gem "warden"
    gem "devise", :git => "git://github.com/plataformatec/devise.git"

  • bug.odesk (at gmail)

    bug.odesk (at gmail) April 2nd, 2010 @ 04:41 PM

    sorry for bad formatting in previous post. here is right one.

    ** Invoke routes (first_time)
    ** Invoke environment (first_time)
    ** Execute environment
    rake aborted!
    conditions may only include [:env, :body, :scheme, :script_name, :path_info, :port, :request_method, :query_string, :content_length, :content_type, :session, :session_options, :logger, :media_type, :media_type_params, :content_charset, :host_with_port, :host, :script_name=, :path_info=, :get?, :post?, :put?, :delete?, :head?, :form_data?, :parseable_data?, :GET, :POST, :params, :[], :[]=, :values_at, :referer, :referrer, :user_agent, :cookies, :xhr?, :url, :path, :fullpath, :accept_encoding, :ip, :taguri=, :taguri, :to_yaml_style, :to_yaml_properties, :to_yaml, :duplicable?, :acts_like?, :blank?, :present?, :presence, :singleton_class, :class_eval, :html_safe?, :with_options, :to_param, :try, :instance_values, :instance_variable_names, :copy_instance_variables_from, :to_json, :as_json, :returning, :is_haml?, :`, :to_query, :subclasses_of, :to_sql, :equality_predicate_sql, :bind, :find_correlate_in, :let, :require_or_load, :require_dependency, :require_association, :load_dependency, :load, :require, :unloadable, :nil?, :===, :=~, :!~, :eql?, :class, :clone, :dup, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :to_s, :inspect, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :extend, :display, :method, :public_method, :define_singleton_method, :hash, :__id__, :object_id, :to_enum, :enum_for, :gem, :silence_warnings, :enable_warnings, :with_warnings, :silence_stderr, :silence_stream, :suppress, :j, :jj, :JSON, :require_library_or_gem, :debugger, :breakpoint, :==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__]
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rack-mount-0.6.1/lib/rack/mount/route_set.rb:142:in `validate_conditions!'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rack-mount-0.6.1/lib/rack/mount/route_set.rb:52:in `add_route'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rack-mount-0.6.1/lib/rack/mount/generation/route_set.rb:17:in `add_route'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rack-mount-0.6.1/lib/rack/mount/recognition/route_set.rb:19:in `add_route'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/routing/route_set.rb:278:in `add_route'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/routing/mapper.rb:193:in `match'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/routing/mapper.rb:330:in `match'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/routing/mapper.rb:666:in `match'
    /Users/user/projects/test/config/routes.rb:6:in `block in '
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/routing/route_set.rb:212:in `instance_exec'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/routing/route_set.rb:212:in `draw'
    /Users/user/Work/httpget/config/routes.rb:1:in `'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:205:in `load'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:205:in `block in load'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:195:in `block in load_dependency'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:523:in `new_constants_in'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:195:in `load_dependency'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:205:in `load'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/application/routes_reloader.rb:29:in `block in reload!'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/application/routes_reloader.rb:29:in `each'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/application/routes_reloader.rb:29:in `reload!'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/application/routes_reloader.rb:41:in `reload_if_changed'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/railtie.rb:14:in `block (2 levels) in '
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/callbacks.rb:438:in `_run_prepare_callbacks'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/callbacks.rb:88:in `run_callbacks'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/callbacks.rb:40:in `initialize'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/stack.rb:74:in `new'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/stack.rb:74:in `build'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/stack.rb:130:in `block in build'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/stack.rb:130:in `each'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/stack.rb:130:in `inject'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/actionpack/lib/action_dispatch/middleware/stack.rb:130:in `build'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/application.rb:127:in `app'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/application/finisher.rb:31:in `block in '
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/initializable.rb:25:in `instance_exec'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/initializable.rb:25:in `run'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/initializable.rb:55:in `block in run_initializers'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/initializable.rb:54:in `each'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/initializable.rb:54:in `run_initializers'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/application.rb:108:in `initialize!'
    /Users/user/.bundle/ruby/1.9.1/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/railties/lib/rails/application.rb:149:in `block in initialize_tasks'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `call'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `each'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
    /opt/local/lib/ruby1.9/1.9.1/monitor.rb:190:in `mon_synchronize'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:607:in `block in invoke_prerequisites'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:604:in `each'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:596:in `block in invoke_with_call_chain'
    /opt/local/lib/ruby1.9/1.9.1/monitor.rb:190:in `mon_synchronize'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
    /opt/local/lib/ruby1.9/gems/1.9.1/gems/rake-0.8.7/bin/rake:31:in `'
    /opt/local/bin/rake:19:in `load'
    /opt/local/bin/rake:19:in `'
    
  • Nicholas Howell

    Nicholas Howell April 3rd, 2010 @ 05:50 PM

    I can confirm bug.odesk is right; subdomain constraints are not working on beta2. I am having the exact same problem.

  • Andrew White

    Andrew White April 3rd, 2010 @ 06:07 PM

    Looks like Rack::Mount uses the method list of Rack::Request by default to validate condition keys. This can be overriden by passing in :request_class when the routeset is created.

    I'll make a patch in the next couple of days if someone doesn't beat me to it.

  • Andrew White

    Andrew White April 4th, 2010 @ 08:31 AM

    Looks like I was beaten to it:
    http://github.com/rails/rails/commit/ab8bf9e152ad75c8b358c85e4c95cf...

    Subdomain constraints now work so this ticket can be closed.

  • Jeremy Kemper

    Jeremy Kemper October 15th, 2010 @ 11:01 PM

    • Milestone set to 3.0.2
    • Importance changed from “” to “Low”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages