在我的应用程序中,一个模型具有与之关联的子域 . 我试图通过自定义域(www.talentbase.ru)托管我的应用程序,并已将* .talentbase.ru添加到heroku应用程序和CNAME到DNS服务器 . 但是,据我所知,由于某种原因,应用程序认为应用程序的域名是herbaseapp.com instread of talentbase.herokuapp.com,并试图将talentbase作为数据库条目 .

heroku domains:

=== talentbase Domain Names
*.talentbase.ru
talentbase.herokuapp.com
talentbase.ru
www.talentbase.ru

heroku logs:

2014-03-09T15:32:45.584836+00:00 app[web.1]: 
2014-03-09T15:32:45.584836+00:00 app[web.1]: ActiveRecord::RecordNotFound (Couldn't find Company with alias = talentbase):
2014-03-09T15:32:45.584836+00:00 app[web.1]:   app/controllers/application_controller.rb:12:in `load_company'
2014-03-09T15:32:45.584836+00:00 app[web.1]: 
2014-03-09T15:32:45.584836+00:00 app[web.1]: 
2014-03-09T15:32:45.587331+00:00 heroku[router]: at=info method=GET path=/ host=talentbase.herokuapp.com request_id=560093ac-9023-467f-988d-f8b4ef049c31 fwd="81.195.3.67" dyno=web.1 connect=6ms service=604ms status=404 bytes=1050
2014-03-09T15:34:27.870381+00:00 heroku[router]: at=error code=H70 desc="Access to bamboo HTTP endpoint denied" method=GET path=/ host=www.talentbase.ru request_id=d067863d-35d9-4f07-8c35-685e357736ea fwd="81.195.3.67" dyno= connect= service= status=503 bytes=
2014-03-09T15:34:30.114866+00:00 heroku[router]: at=error code=H70 desc="Access to bamboo HTTP endpoint denied" method=GET path=/ host=www.talentbase.ru request_id=9bb3ea26-2c00-4222-ac26-88b70fcc3d88 fwd="81.195.3.67" dyno= connect= service= status=503 bytes=
2014-03-09T15:35:27.577359+00:00 heroku[router]: at=error code=H70 desc="Access to bamboo HTTP endpoint denied" method=GET path=/ host=www.talentbase.ru request_id=6eee95cd-cd71-4382-b3c8-d72e4ff94103 fwd="81.195.3.67" dyno= connect= service= status=503 bytes=
2014-03-09T15:35:33.424537+00:00 heroku[router]: at=error code=H70 desc="Access to bamboo HTTP endpoint denied" method=GET path=/ host=www.talentbase.ru request_id=d146b16d-5959-467d-a512-57f5495c2e7d fwd="81.195.3.67" dyno= connect= service= status=503 bytes=
2014-03-09T15:36:04.261650+00:00 heroku[router]: at=error code=H70 desc="Access to bamboo HTTP endpoint denied" method=GET path=/ host=www.talentbase.ru request_id=82917182-67c8-4f86-973a-d9e87e0937ae fwd="81.195.3.67" dyno= connect= service= status=503 bytes=
2014-03-09T15:37:51.165376+00:00 heroku[router]: at=error code=H70 desc="Access to bamboo HTTP endpoint denied" method=GET path=/ host=www.talentbase.ru request_id=d6e8bc00-2e7e-41ac-993a-ca83f855ce64 fwd="81.195.3.67" dyno= connect= service= status=503 bytes=
2014-03-09T15:44:44.478785+00:00 app[web.1]: Started GET "/" for 46.242.68.112 at 2014-03-09 15:44:44 +0000
2014-03-09T15:44:44.483524+00:00 app[web.1]: Processing by CompaniesController#show as HTML
2014-03-09T15:44:44.780423+00:00 heroku[router]: at=info method=GET path=/ host=www.talentbase.ru request_id=51210aee-e2fb-4b03-8ad0-54a8a233aaa1 fwd="46.242.68.112" dyno=web.1 connect=6ms service=303ms status=404 bytes=1050
2014-03-09T15:44:44.777901+00:00 app[web.1]: ActiveRecord::RecordNotFound (Couldn't find Company without an ID):
2014-03-09T15:44:44.776412+00:00 app[web.1]: Completed 404 Not Found in 292.6ms
2014-03-09T15:44:44.777901+00:00 app[web.1]: 
2014-03-09T15:44:44.777901+00:00 app[web.1]:   app/controllers/application_controller.rb:14:in `load_company'
2014-03-09T15:44:44.777901+00:00 app[web.1]: 
2014-03-09T15:44:44.777901+00:00 app[web.1]: 
2014-03-09T15:44:46.427771+00:00 app[web.1]: Started GET "/" for 46.242.68.112 at 2014-03-09 15:44:46 +0000
2014-03-09T15:44:46.433031+00:00 app[web.1]: Processing by CompaniesController#show as HTML
2014-03-09T15:44:46.845063+00:00 app[web.1]: Completed 404 Not Found in 411.5ms
2014-03-09T15:44:46.847043+00:00 app[web.1]: 
2014-03-09T15:44:46.847043+00:00 app[web.1]:   app/controllers/application_controller.rb:14:in `load_company'
2014-03-09T15:44:46.847043+00:00 app[web.1]: 
2014-03-09T15:44:46.847043+00:00 app[web.1]: 
2014-03-09T15:44:46.847043+00:00 app[web.1]: ActiveRecord::RecordNotFound (Couldn't find Company without an ID):
2014-03-09T15:45:07.606906+00:00 app[web.1]: Processing by CompaniesController#show as HTML
2014-03-09T15:45:07.602902+00:00 app[web.1]: Started GET "/" for 46.242.68.112 at 2014-03-09 15:45:07 +0000
2014-03-09T15:45:08.247375+00:00 app[web.1]: 
2014-03-09T15:45:08.245711+00:00 app[web.1]: Completed 404 Not Found in 638.6ms
2014-03-09T15:45:08.247375+00:00 app[web.1]: ActiveRecord::RecordNotFound (Couldn't find Company without an ID):
2014-03-09T15:45:08.247375+00:00 app[web.1]:   app/controllers/application_controller.rb:14:in `load_company'
2014-03-09T15:45:08.247375+00:00 app[web.1]: 
2014-03-09T15:45:08.247375+00:00 app[web.1]: 
2014-03-09T15:45:10.561957+00:00 app[web.1]: Started GET "/" for 46.242.68.112 at 2014-03-09 15:45:10 +0000
2014-03-09T15:45:10.565279+00:00 app[web.1]: Processing by CompaniesController#show as HTML
2014-03-09T15:45:10.850874+00:00 heroku[router]: at=info method=GET path=/ host=www.talentbase.ru request_id=64c146f1-f9f2-4c52-bdad-2c9e0bb86755 fwd="46.242.68.112" dyno=web.1 connect=1ms service=291ms status=404 bytes=1050
2014-03-09T15:45:10.847787+00:00 app[web.1]: Completed 404 Not Found in 282.3ms
2014-03-09T15:45:10.849517+00:00 app[web.1]: 
2014-03-09T15:45:10.849517+00:00 app[web.1]: 
2014-03-09T15:45:10.849517+00:00 app[web.1]: ActiveRecord::RecordNotFound (Couldn't find Company without an ID):
2014-03-09T15:45:10.849517+00:00 app[web.1]:   app/controllers/application_controller.rb:14:in `load_company'
2014-03-09T15:45:10.849517+00:00 app[web.1]: 
2014-03-09T15:45:08.250732+00:00 heroku[router]: at=info method=GET path=/ host=www.talentbase.ru request_id=0ac8dabd-b6a0-4e45-a09f-4199eb5c6d7c fwd="46.242.68.112" dyno=web.1 connect=1ms service=648ms status=404 bytes=1050
2014-03-09T15:46:12.616106+00:00 app[web.1]: Started GET "/" for 46.242.68.112 at 2014-03-09 15:46:12 +0000
2014-03-09T15:46:12.619336+00:00 app[web.1]: Processing by CompaniesController#show as HTML
2014-03-09T15:46:12.911041+00:00 app[web.1]: ActiveRecord::RecordNotFound (Couldn't find Company without an ID):
2014-03-09T15:46:12.911041+00:00 app[web.1]:   app/controllers/application_controller.rb:14:in `load_company'
2014-03-09T15:46:12.911041+00:00 app[web.1]: 
2014-03-09T15:46:12.911041+00:00 app[web.1]: 
2014-03-09T15:46:12.909501+00:00 app[web.1]: Completed 404 Not Found in 290.0ms
2014-03-09T15:46:12.911041+00:00 app[web.1]: 
2014-03-09T15:44:46.850005+00:00 heroku[router]: at=info method=GET path=/ host=www.talentbase.ru request_id=9b57bd04-43cb-4032-b39b-2addbb162625 fwd="46.242.68.112" dyno=web.1 connect=2ms service=422ms status=404 bytes=1050
2014-03-09T15:46:12.917581+00:00 heroku[router]: at=info method=GET path=/ host=www.talentbase.ru request_id=d6827a90-eddf-4059-ba59-dbd2323fc0fa fwd="46.242.68.112" dyno=web.1 connect=4ms service=304ms status=404 bytes=1050
2014-03-09T15:53:16.430164+00:00 heroku[router]: at=info method=GET path=/ host=www.talentbase.ru request_id=fca6bf9a-7e41-4403-8428-cb98f2c2d29d fwd="81.195.3.67" dyno=web.1 connect=1ms service=6ms status=301 bytes=259
2014-03-09T15:53:22.805183+00:00 app[web.1]: Started GET "/" for 81.195.3.67 at 2014-03-09 15:53:22 +0000
2014-03-09T15:53:22.809152+00:00 app[web.1]: Processing by CompaniesController#show as HTML
2014-03-09T15:53:23.096761+00:00 heroku[router]: at=info method=GET path=/ host=www.talentbase.ru request_id=acea2db2-2e88-4344-a9a6-1a6f4fe8a1a8 fwd="81.195.3.67" dyno=web.1 connect=3ms service=295ms status=404 bytes=1050
2014-03-09T15:53:23.527505+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=www.talentbase.ru request_id=21194445-57ee-4ec9-874f-2e74a87c928a fwd="81.195.3.67" dyno=web.1 connect=13ms service=17ms status=200 bytes=361
2014-03-09T15:53:23.093693+00:00 app[web.1]: Completed 404 Not Found in 284.3ms
2014-03-09T15:53:23.095331+00:00 app[web.1]: 
2014-03-09T15:53:23.095331+00:00 app[web.1]: ActiveRecord::RecordNotFound (Couldn't find Company without an ID):
2014-03-09T15:53:23.095331+00:00 app[web.1]:   app/controllers/application_controller.rb:14:in `load_company'
2014-03-09T15:53:23.095331+00:00 app[web.1]: 
2014-03-09T15:53:23.095331+00:00 app[web.1]: 
2014-03-09T15:53:25.924870+00:00 app[web.1]: Started GET "/" for 81.195.3.67 at 2014-03-09 15:53:25 +0000
2014-03-09T15:53:25.928235+00:00 app[web.1]: Processing by CompaniesController#show as HTML
2014-03-09T15:53:26.237297+00:00 heroku[router]: at=info method=GET path=/ host=www.talentbase.ru request_id=ff486eec-48d4-43d4-8798-2d5253f1c086 fwd="81.195.3.67" dyno=web.1 connect=1ms service=315ms status=404 bytes=1050
2014-03-09T15:53:26.236405+00:00 app[web.1]: ActiveRecord::RecordNotFound (Couldn't find Company without an ID):
2014-03-09T15:53:26.236405+00:00 app[web.1]:   app/controllers/application_controller.rb:14:in `load_company'
2014-03-09T15:53:26.234675+00:00 app[web.1]: Completed 404 Not Found in 306.2ms
2014-03-09T15:53:26.236405+00:00 app[web.1]: 
2014-03-09T15:53:26.236405+00:00 app[web.1]: 
2014-03-09T15:53:26.236405+00:00 app[web.1]: 
2014-03-09T15:53:26.426103+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=www.talentbase.ru request_id=a3c5c9ab-0887-4167-a300-8f06d22e55fa fwd="81.195.3.67" dyno=web.1 connect=1ms service=7ms status=200 bytes=369
2014-03-09T15:54:20.062417+00:00 heroku[router]: at=error code=H70 desc="Access to bamboo HTTP endpoint denied" method=GET path=/ host=www.talentbase.ru request_id=f6a8f13c-dc31-499c-b7ad-b82c699b1f85 fwd="81.195.3.67" dyno= connect= service= status=503 bytes=
2014-03-09T15:54:48.285762+00:00 heroku[router]: at=error code=H70 desc="Access to bamboo HTTP endpoint denied" method=GET path=/ host=www.talentbase.ru request_id=bd0c8466-1b79-43d0-aee9-15660b6ef9e8 fwd="81.195.3.67" dyno= connect= service= status=503 bytes=
2014-03-09T15:55:12.234650+00:00 heroku[router]: at=error code=H70 desc="Access to bamboo HTTP endpoint denied" method=GET path=/ host=www.talentbase.ru request_id=acee7d05-9630-42b1-9472-c9bf87c34bc0 fwd="81.195.3.67" dyno= connect= service= status=503 bytes=
2014-03-09T15:54:57.103335+00:00 heroku[router]: at=error code=H70 desc="Access to bamboo HTTP endpoint denied" method=GET path=/ host=www.talentbase.ru request_id=34e6a841-cc82-4fb7-963e-925ee8b7de7a fwd="81.195.3.67" dyno= connect= service= status=503 bytes=
2014-03-09T16:00:17+00:00 heroku[slug-compiler]: Slug compilation started
2014-03-09T16:01:33+00:00 heroku[slug-compiler]: Slug compilation finished
2014-03-09T16:01:33.511196+00:00 heroku[api]: Deploy 93178f8 by *****@gmail.com
2014-03-09T16:01:33.511196+00:00 heroku[api]: Release v35 created by *****@gmail.com
2014-03-09T16:01:33.852746+00:00 heroku[web.1]: State changed from up to starting
2014-03-09T16:01:36.573006+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-03-09T16:01:38.354647+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -R config.ru -e $RAILS_ENV -p 51080`
2014-03-09T16:01:39.423096+00:00 heroku[web.1]: Process exited with status 0
2014-03-09T16:01:42.679483+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2014-03-09T16:01:43.362577+00:00 app[web.1]: [deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
2014-03-09T16:01:44.083093+00:00 app[web.1]: Listening on 0.0.0.0:51080, CTRL+C to stop
2014-03-09T16:01:44.083093+00:00 app[web.1]: Thi
n web server (v1.6.1 codename Death Proof)
2014-03-09T16:01:44.083093+00:00 app[web.1]: Maximum connections set to 1024
2014-03-09T16:01:44.244045+00:00 heroku[web.1]: State changed from starting to up
2014-03-09T17:09:07.095972+00:00 heroku[web.1]: State changed from up to down
2014-03-09T17:09:07.095172+00:00 heroku[web.1]: Idling
2014-03-09T17:09:09.914049+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-03-09T17:09:12.478843+00:00 heroku[web.1]: Process exited with status 0
2014-03-09T19:26:48.008782+00:00 heroku[router]: at=error code=H70 desc="Access to bamboo HTTP endpoint denied" method=GET path=/ host=www.talentbase.ru request_id=ffb68d4e-3bdf-4635-b130-9ca607815c1e fwd="81.195.3.67" dyno= connect= service= status=503 bytes=

routes.rb

constraints(Subdomain) do

    match '/', to: 'companies#show'
    match '/edit', to: 'companies#edit'
    match '/jobs', to: 'companies#jobs'
    match '/destroy', to: 'companies#jobs'
    match '/photos', to: 'companies#photos'
    match '/company_photos', to: 'companies#company_photos'

    put '/companies/:id', to: 'companies#update'
  end



class Subdomain
  def self.matches?(request)
    if Rails.env.development?
      request.subdomain.present? && request.subdomain != 'www' && !request.subdomain.blank?

    elsif Rails.env.production?
      host = request.host.split('.').first
      host.present? && host != 'www' && host != 'talentbase' && !host.blank?
    end
  end
end

DNS CONFIGS

Subdomain/Service   Class   Adress      
*                   CNAME   talentbase.herokuapp.com.               
www                 CNAME   talentbase.herokuapp.com.

有人可以指导我正确的方向吗?谢谢