0

我有一个在本地运行良好的应用程序,但是我尝试推送到 heroku 并且 root_to 路由不起作用。

我已经浏览并查看了所有其他帖子,但没有一个是针对 route_to 文件的,而且我在网上找到的修复程序都没有工作。

我安装了activeadmin,所以我不确定这是否会影响它。我正在使用设计来处理用户。

请帮忙,这是一个简单的网站,我不知道为什么它会造成这么多麻烦。

Github 仓库:https ://github.com/spq24/sered

路由.rb

Seered::Application.routes.draw do
break if ARGV.join.include? 'assets:precompile'
 ActiveAdmin.routes(self)

 devise_for :admin_users, ActiveAdmin::Devise.config

 devise_for :users

 root :to => 'pages#home'

 get "pages/home"

 match '/about',     to: 'pages#about'

耙路线输出:

                admin_root            /admin(.:format)
        admin/dashboard#index
    batch_action_admin_admin_users POST       /admin/admin_users/batch_action(.:for
    at) admin/admin_users#batch_action
                 admin_admin_users GET        /admin/admin_users(.:format)
        admin/admin_users#index
                                   POST       /admin/admin_users(.:format)
        admin/admin_users#create
              new_admin_admin_user GET        /admin/admin_users/new(.:format)
        admin/admin_users#new
             edit_admin_admin_user GET        /admin/admin_users/:id/edit(.:format)
        admin/admin_users#edit
                  admin_admin_user GET        /admin/admin_users/:id(.:format)
        admin/admin_users#show
                                   PUT        /admin/admin_users/:id(.:format)
        admin/admin_users#update
                                   DELETE     /admin/admin_users/:id(.:format)
        admin/admin_users#destroy
                   admin_dashboard            /admin/dashboard(.:format)
        admin/dashboard#index
          batch_action_admin_users POST       /admin/users/batch_action(.:format)
        admin/users#batch_action
                       admin_users GET        /admin/users(.:format)
        admin/users#index
                                   POST       /admin/users(.:format)
        admin/users#create
                    new_admin_user GET        /admin/users/new(.:format)
        admin/users#new
                   edit_admin_user GET        /admin/users/:id/edit(.:format)
        admin/users#edit
                        admin_user GET        /admin/users/:id(.:format)
        admin/users#show
                                   PUT        /admin/users/:id(.:format)
        admin/users#update
                                   DELETE     /admin/users/:id(.:format)
        admin/users#destroy
       batch_action_admin_comments POST       /admin/comments/batch_action(.:format
        admin/comments#batch_action
                    admin_comments GET        /admin/comments(.:format)
        admin/comments#index
                                   POST       /admin/comments(.:format)
        admin/comments#create
                     admin_comment GET        /admin/comments/:id(.:format)
        admin/comments#show
            new_admin_user_session GET        /admin/login(.:format)
        active_admin/devise/sessions#new
                admin_user_session POST       /admin/login(.:format)
        active_admin/devise/sessions#create
        destroy_admin_user_session DELETE|GET /admin/logout(.:format)
        active_admin/devise/sessions#destroy
               admin_user_password POST       /admin/password(.:format)
        active_admin/devise/passwords#create
           new_admin_user_password GET        /admin/password/new(.:format)
        active_admin/devise/passwords#new
          edit_admin_user_password GET        /admin/password/edit(.:format)
        active_admin/devise/passwords#edit
                                   PUT        /admin/password(.:format)
        active_admin/devise/passwords#update
                  new_user_session GET        /users/sign_in(.:format)
        devise/sessions#new
                      user_session POST       /users/sign_in(.:format)
        devise/sessions#create
              destroy_user_session DELETE     /users/sign_out(.:format)
        devise/sessions#destroy
          cancel_user_registration GET        /users/cancel(.:format)
        devise/registrations#cancel
                 user_registration POST       /users(.:format)
        devise/registrations#create
             new_user_registration GET        /users/sign_up(.:format)
        devise/registrations#new
            edit_user_registration GET        /users/edit(.:format)
        devise/registrations#edit
                                   PUT        /users(.:format)
        devise/registrations#update
                                   DELETE     /users(.:format)
        devise/registrations#destroy
                              root            /
        pages#home
                        pages_home GET        /pages/home(.:format)
        pages#home
                             about            /about(.:format)

配置/环境/生产

Seered::Application.configure do
      # Settings specified here will take precedence over those in   config/application.rb

      # Code is not reloaded between requests
      config.cache_classes = true

      # Full error reports are disabled and caching is turned on
      config.consider_all_requests_local       = false
      config.action_controller.perform_caching = true

      # Disable Rails's static asset server (Apache or nginx will already do this)
      config.serve_static_assets = false

      # Compress JavaScripts and CSS
      config.assets.compress = true

      # Don't fallback to assets pipeline if a precompiled asset is missed
      config.assets.compile = true

      # Generate digests for assets URLs
      config.assets.digest = true

      # Defaults to nil and saved in location specified by config.assets.prefix
      # config.assets.manifest = YOUR_PATH

      # Specifies the header that your server uses for sending files
      # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
      # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx

      # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
      # config.force_ssl = true

      # See everything in the log (default is :info)
      # config.log_level = :debug

      # Prepend all log lines with the following tags
      # config.log_tags = [ :subdomain, :uuid ]

      # Use a different logger for distributed setups
      # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)

      # Use a different cache store in production
      # config.cache_store = :mem_cache_store

      # Enable serving of images, stylesheets, and JavaScripts from an asset server
      # config.action_controller.asset_host = "http://assets.example.com"

      # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
      # config.assets.precompile += %w( search.js )

      # Disable delivery errors, bad email addresses will be ignored
      # config.action_mailer.raise_delivery_errors = false

      # Enable threaded mode
      # config.threadsafe!

      # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
      # the I18n.default_locale when a translation can not be found)
      config.i18n.fallbacks = true

      # Send deprecation notices to registered listeners
      config.active_support.deprecation = :notify

      # Log the query plan for queries taking more than this (works
      # with SQLite, MySQL, and PostgreSQL)
      # config.active_record.auto_explain_threshold_in_seconds = 0.5

      #Domain name for Devise
      config.action_mailer.default_url_options = { :host => 'localhost:3000' }
      config.assets.initialize_on_precompile = false
    end
4

1 回答 1

0

尝试先放置根路由。这通常是推荐的,因为它通常是应用程序中访问最多的路由。

于 2013-05-02T10:45:46.540 回答