【问题标题】:Rails3 subdomain routingRails3 子域路由
【发布时间】:2023-03-08 15:27:01
【问题描述】:

我正在尝试将我的 Rails 2.3.5 应用程序移植到 Rails 3,但遇到以下路由配置问题:

 ActionController::Routing::Routes.draw do |map| 
     map.app  '', :controller => 'projects', :action => 'index', :conditions => {:subdomain => true}

      map.with_options :controller  => 'site', :action => 'page', :subdomain => false, :conditions => {:subdomain => false} do |site|
        site.site             '',        :path => 'index'
        site.pricing          'pricing', :path => 'pricing'
        site.tour             'tour',    :path => 'tour'
        site.about            'about',   :path => 'about'    
        site.contact          'contact', :path => 'contact'
        site.privacy          'privacy', :path => 'privacy'    
        site.terms            'terms',   :path => 'terms'
      end
    end

rails 2.3.5 应用程序使用 subdomain-fu 作为子域条件...如何使用 Rails 3 执行此操作?我想要2条空白路线。如果存在子域,它会路由到应用程序,如果没有子域,它应该路由到站点。

【问题讨论】:

  • 我一直在试图弄清楚同样的事情。

标签: ruby-on-rails ruby-on-rails-3 routes


【解决方案1】:

只要详细看看railscast就知道子域问题。

【讨论】:

    猜你喜欢
    • 2011-10-12
    • 2011-07-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-24
    相关资源
    最近更新 更多