Heroku 500错误(Heroku 500 error)
在production.rb中,我有以下单行config.action_mailer ..
config.action_mailer.default_url_options = { :host => 'secret-brushlands- 1375.herokuapp.com' }
在Development.rb我有(这似乎工作BTW)
config.action_mailer.perform_deliveries = true config.action_mailer.default_url_options = { :host => 'localhost:3000'} config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = {:address => "localhost", :port => 1025}
在Environment.rb我有:
ActionMailer::Base.smtp_settings = { :address => 'smtp.sendgrid.net', :port => '587', :authentication => :plain, :user_name => ENV['sendgrid user'], :password => ENV['sendgrid password'], :domain => 'heroku.com', :enable_starttls_auto => true }
我们很抱歉,但是出现了一些问题。
出于某种原因,我的heroku应用程序出现了这个错误(当我尝试sign_up时,这只发生在用户部分,postgresql上的其他模型功能似乎很酷) - 我做了一个heroku pg:reset heroku run rake :db:migrate等等但无济于事。
这是我的宝石文件:
source 'https://rubygems.org' gem 'rails', '4.1.0' gem 'pg' gem 'foundation-rails' gem 'rails_12factor', group: :production gem 'devise' gem 'sass-rails', '~> 4.0.3' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.0.0' gem 'jquery-rails' gem 'turbolinks' gem 'jbuilder', '~> 2.0' gem 'sdoc', '~> 0.4.0', group: :doc gem 'tzinfo' gem 'tzinfo-data'
这是heroku日志:
2014-04-24T17:34:53.598955+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/transactions.rb:329:in `block in with_transact ion_returning_status' 2014-04-24T17:34:53.598952+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/attribute_methods/dirty.rb:21:in `save' 2014-04-24T17:34:53.598961+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statemen ts.rb:211:in `transaction' 2014-04-24T17:34:53.598957+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statemen ts.rb:211:in `block in transaction' 2014-04-24T17:34:53.598959+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statemen ts.rb:219:in `within_new_transaction' 2014-04-24T17:34:53.599212+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/transactions.rb:326:in `with_transaction_retur ning_status' 2014-04-24T17:34:53.599214+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/transactions.rb:268:in `block in save' 2014-04-24T17:34:53.599209+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/transactions.rb:208:in `transaction' 2014-04-24T17:34:53.599215+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/transactions.rb:283:in `rollback_active_record _state!' 2014-04-24T17:34:53.599228+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:229:in `block in halting' 2014-04-24T17:34:53.599218+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/dev ise-3.2.4/app/controllers/devise/registrations_controller.rb:15:in `create' 2014-04-24T17:34:53.599223+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal/rendering.rb:10:in `process_action' 2014-04-24T17:34:53.599220+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal/implicit_render.rb:4:in `send_action' 2014-04-24T17:34:53.599231+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:229:in `block in halting' 2014-04-24T17:34:53.599217+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/transactions.rb:267:in `save' 2014-04-24T17:34:53.599224+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/abstract_controller/callbacks.rb:20:in `block in process_actio n' 2014-04-24T17:34:53.599230+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:229:in `call' 2014-04-24T17:34:53.599233+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:166:in `call' 2014-04-24T17:34:53.599227+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:113:in `call' 2014-04-24T17:34:53.599221+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/abstract_controller/base.rb:189:in `process_action' 2014-04-24T17:34:53.599225+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:113:in `call' 2014-04-24T17:34:53.599234+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:166:in `block in halting' 2014-04-24T17:34:53.599237+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:166:in `block in halting' 2014-04-24T17:34:53.599239+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:166:in `call' 2014-04-24T17:34:53.599236+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:166:in `call' 2014-04-24T17:34:53.599258+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:166:in `call' 2014-04-24T17:34:53.599262+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:149:in `block in halting_and_co nditional' 2014-04-24T17:34:53.599260+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:149:in `call' 2014-04-24T17:34:53.599263+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:149:in `call' 2014-04-24T17:34:53.599256+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:166:in `block in halting' 2014-04-24T17:34:53.599266+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:86:in `call' 2014-04-24T17:34:53.599265+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:149:in `block in halting_and_co nditional' 2014-04-24T17:34:53.599276+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/abstract_controller/callbacks.rb:19:in `process_action' 2014-04-24T17:34:53.599259+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:166:in `block in halting' 2014-04-24T17:34:53.599268+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:86:in `run_callbacks' 2014-04-24T17:34:53.599278+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal/rescue.rb:29:in `process_action' 2014-04-24T17:34:53.599282+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/notifications/instrumenter.rb:20:in `instrum ent' 2014-04-24T17:34:53.599286+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal/params_wrapper.rb:250:in `process_acti on' 2014-04-24T17:34:53.599284+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/notifications.rb:159:in `instrument' 2014-04-24T17:34:53.599281+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/notifications.rb:159:in `block in instrument ' 2014-04-24T17:34:53.599279+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal/instrumentation.rb:31:in `block in pro cess_action' 2014-04-24T17:34:53.599322+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/railties/controller_runtime.rb:18:in `process_ action' 2014-04-24T17:34:53.599325+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionview-4.1.0/lib/action_view/rendering.rb:30:in `process' 2014-04-24T17:34:53.599285+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal/instrumentation.rb:30:in `process_acti on' 2014-04-24T17:34:53.599324+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/abstract_controller/base.rb:136:in `process' 2014-04-24T17:34:53.599327+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal.rb:195:in `dispatch' 2014-04-24T17:34:53.599332+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/routing/route_set.rb:80:in `call' 2014-04-24T17:34:53.599338+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/routing/mapper.rb:45:in `call' 2014-04-24T17:34:53.599341+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/journey/router.rb:71:in `block in call' 2014-04-24T17:34:53.599330+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal.rb:231:in `block in action' 2014-04-24T17:34:53.599329+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch' 2014-04-24T17:34:53.599334+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/routing/route_set.rb:80:in `dispatch' 2014-04-24T17:34:53.599345+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/journey/router.rb:59:in `call' 2014-04-24T17:34:53.599336+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/routing/route_set.rb:48:in `call' 2014-04-24T17:34:53.599343+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/journey/router.rb:59:in `each' 2014-04-24T17:34:53.599347+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/routing/route_set.rb:676:in `call' 2014-04-24T17:34:53.599355+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/war den-1.2.3/lib/warden/manager.rb:34:in `catch' 2014-04-24T17:34:53.599357+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/war den-1.2.3/lib/warden/manager.rb:34:in `call' 2014-04-24T17:34:53.599363+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/head.rb:11:in `call' 2014-04-24T17:34:53.599353+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/war den-1.2.3/lib/warden/manager.rb:35:in `block in call' 2014-04-24T17:34:53.599359+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/etag.rb:23:in `call' 2014-04-24T17:34:53.599369+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/session/abstract/id.rb:225:in `context' 2014-04-24T17:34:53.599361+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/conditionalget.rb:35:in `call' 2014-04-24T17:34:53.599367+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/flash.rb:254:in `call' 2014-04-24T17:34:53.599370+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/session/abstract/id.rb:220:in `call' 2014-04-24T17:34:53.599365+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/params_parser.rb:27:in `call' 2014-04-24T17:34:53.599376+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/connection_adapters/abstract/connection_pool.r b:621:in `call' 2014-04-24T17:34:53.599372+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/cookies.rb:560:in `call' 2014-04-24T17:34:53.599374+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/query_cache.rb:36:in `call' 2014-04-24T17:34:53.599389+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' 2014-04-24T17:34:53.599380+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:82:in `run_callbacks' 2014-04-24T17:34:53.599384+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/remote_ip.rb:76:in `call' 2014-04-24T17:34:53.599382+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/callbacks.rb:27:in `call' 2014-04-24T17:34:53.599378+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' 2014-04-24T17:34:53.599391+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rai lties-4.1.0/lib/rails/rack/logger.rb:38:in `call_app' 2014-04-24T17:34:53.599386+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' 2014-04-24T17:34:53.599393+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rai lties-4.1.0/lib/rails/rack/logger.rb:20:in `block in call' 2014-04-24T17:34:53.599398+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/tagged_logging.rb:26:in `tagged' 2014-04-24T17:34:53.599396+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/tagged_logging.rb:68:in `block in tagged' 2014-04-24T17:34:53.599440+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/methodoverride.rb:21:in `call' 2014-04-24T17:34:53.599488+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/runtime.rb:17:in `call' 2014-04-24T17:34:53.599433+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/request_id.rb:21:in `call' 2014-04-24T17:34:53.599414+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rai lties-4.1.0/lib/rails/rack/logger.rb:20:in `call' 2014-04-24T17:34:53.599400+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/tagged_logging.rb:68:in `tagged' 2014-04-24T17:34:53.599493+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/static.rb:64:in `call' 2014-04-24T17:34:53.599491+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/cache/strategy/local_cache_middleware.rb:26: in `call' 2014-04-24T17:34:53.599495+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/sendfile.rb:112:in `call' 2014-04-24T17:34:53.599497+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rai lties-4.1.0/lib/rails/engine.rb:514:in `call' 2014-04-24T17:34:53.599499+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rai lties-4.1.0/lib/rails/application.rb:144:in `call' 2014-04-24T17:34:53.599501+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/lock.rb:17:in `call' 2014-04-24T17:34:53.599503+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/handler/webrick.rb:60:in `service' 2014-04-24T17:34:53.599502+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/content_length.rb:14:in `call' 2014-04-24T17:34:53.599506+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/ webrick/httpserver.rb:94:in `run' 2014-04-24T17:34:53.599505+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/ webrick/httpserver.rb:138:in `service' 2014-04-24T17:34:53.599509+00:00 app[web.1]: 2014-04-24T17:34:53.599508+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/ webrick/server.rb:295:in `block in start_thread' 2014-04-24T17:34:53.599510+00:00 app[web.1]: 2014-04-24T17:34:53.588804+00:00 app[web.1]: 2014-04-24T17:34:53.588813+00:00 app[web.1]: Sent mail to tstevens_21@earthlink. net (66.7ms) 2014-04-24T17:34:53.595347+00:00 app[web.1]: Completed 500 Internal Server Error in 389ms 2014-04-24T17:34:53.600317+00:00 heroku[router]: at=info method=POST path=/users host=secret-brushlands-1375.herokuapp.com request_id=052e3b18-a726-49ae-b816-1b b5b13c8367 fwd="216.40.153.100" dyno=web.1 connect=3ms service=408ms status=500 bytes=1754
我正在使用Devise,我在Heroku上安装了SendGrid。 还没有看到电子邮件确认。 任何帮助赞赏。
谢谢,
In production.rb I have the following single line for config.action_mailer..
config.action_mailer.default_url_options = { :host => 'secret-brushlands- 1375.herokuapp.com' }
In Development.rb I have (this seems to work BTW)
config.action_mailer.perform_deliveries = true config.action_mailer.default_url_options = { :host => 'localhost:3000'} config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = {:address => "localhost", :port => 1025}
In Environment.rb I have:
ActionMailer::Base.smtp_settings = { :address => 'smtp.sendgrid.net', :port => '587', :authentication => :plain, :user_name => ENV['sendgrid user'], :password => ENV['sendgrid password'], :domain => 'heroku.com', :enable_starttls_auto => true }
We're sorry, but something went wrong.
For some reason I am getting this error with my heroku app (this is only happening with the users portion when I try to sign_up, the other model functionality on postgresql seems to be cool) - I have done a heroku pg:reset heroku run rake:db:migrate, etc.. but to no avail.
Here is my gem file:
source 'https://rubygems.org' gem 'rails', '4.1.0' gem 'pg' gem 'foundation-rails' gem 'rails_12factor', group: :production gem 'devise' gem 'sass-rails', '~> 4.0.3' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.0.0' gem 'jquery-rails' gem 'turbolinks' gem 'jbuilder', '~> 2.0' gem 'sdoc', '~> 0.4.0', group: :doc gem 'tzinfo' gem 'tzinfo-data'
And here is the heroku log:
2014-04-24T17:34:53.598955+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/transactions.rb:329:in `block in with_transact ion_returning_status' 2014-04-24T17:34:53.598952+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/attribute_methods/dirty.rb:21:in `save' 2014-04-24T17:34:53.598961+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statemen ts.rb:211:in `transaction' 2014-04-24T17:34:53.598957+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statemen ts.rb:211:in `block in transaction' 2014-04-24T17:34:53.598959+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statemen ts.rb:219:in `within_new_transaction' 2014-04-24T17:34:53.599212+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/transactions.rb:326:in `with_transaction_retur ning_status' 2014-04-24T17:34:53.599214+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/transactions.rb:268:in `block in save' 2014-04-24T17:34:53.599209+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/transactions.rb:208:in `transaction' 2014-04-24T17:34:53.599215+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/transactions.rb:283:in `rollback_active_record _state!' 2014-04-24T17:34:53.599228+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:229:in `block in halting' 2014-04-24T17:34:53.599218+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/dev ise-3.2.4/app/controllers/devise/registrations_controller.rb:15:in `create' 2014-04-24T17:34:53.599223+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal/rendering.rb:10:in `process_action' 2014-04-24T17:34:53.599220+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal/implicit_render.rb:4:in `send_action' 2014-04-24T17:34:53.599231+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:229:in `block in halting' 2014-04-24T17:34:53.599217+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/transactions.rb:267:in `save' 2014-04-24T17:34:53.599224+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/abstract_controller/callbacks.rb:20:in `block in process_actio n' 2014-04-24T17:34:53.599230+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:229:in `call' 2014-04-24T17:34:53.599233+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:166:in `call' 2014-04-24T17:34:53.599227+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:113:in `call' 2014-04-24T17:34:53.599221+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/abstract_controller/base.rb:189:in `process_action' 2014-04-24T17:34:53.599225+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:113:in `call' 2014-04-24T17:34:53.599234+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:166:in `block in halting' 2014-04-24T17:34:53.599237+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:166:in `block in halting' 2014-04-24T17:34:53.599239+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:166:in `call' 2014-04-24T17:34:53.599236+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:166:in `call' 2014-04-24T17:34:53.599258+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:166:in `call' 2014-04-24T17:34:53.599262+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:149:in `block in halting_and_co nditional' 2014-04-24T17:34:53.599260+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:149:in `call' 2014-04-24T17:34:53.599263+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:149:in `call' 2014-04-24T17:34:53.599256+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:166:in `block in halting' 2014-04-24T17:34:53.599266+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:86:in `call' 2014-04-24T17:34:53.599265+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:149:in `block in halting_and_co nditional' 2014-04-24T17:34:53.599276+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/abstract_controller/callbacks.rb:19:in `process_action' 2014-04-24T17:34:53.599259+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:166:in `block in halting' 2014-04-24T17:34:53.599268+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:86:in `run_callbacks' 2014-04-24T17:34:53.599278+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal/rescue.rb:29:in `process_action' 2014-04-24T17:34:53.599282+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/notifications/instrumenter.rb:20:in `instrum ent' 2014-04-24T17:34:53.599286+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal/params_wrapper.rb:250:in `process_acti on' 2014-04-24T17:34:53.599284+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/notifications.rb:159:in `instrument' 2014-04-24T17:34:53.599281+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/notifications.rb:159:in `block in instrument ' 2014-04-24T17:34:53.599279+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal/instrumentation.rb:31:in `block in pro cess_action' 2014-04-24T17:34:53.599322+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/railties/controller_runtime.rb:18:in `process_ action' 2014-04-24T17:34:53.599325+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionview-4.1.0/lib/action_view/rendering.rb:30:in `process' 2014-04-24T17:34:53.599285+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal/instrumentation.rb:30:in `process_acti on' 2014-04-24T17:34:53.599324+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/abstract_controller/base.rb:136:in `process' 2014-04-24T17:34:53.599327+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal.rb:195:in `dispatch' 2014-04-24T17:34:53.599332+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/routing/route_set.rb:80:in `call' 2014-04-24T17:34:53.599338+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/routing/mapper.rb:45:in `call' 2014-04-24T17:34:53.599341+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/journey/router.rb:71:in `block in call' 2014-04-24T17:34:53.599330+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal.rb:231:in `block in action' 2014-04-24T17:34:53.599329+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch' 2014-04-24T17:34:53.599334+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/routing/route_set.rb:80:in `dispatch' 2014-04-24T17:34:53.599345+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/journey/router.rb:59:in `call' 2014-04-24T17:34:53.599336+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/routing/route_set.rb:48:in `call' 2014-04-24T17:34:53.599343+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/journey/router.rb:59:in `each' 2014-04-24T17:34:53.599347+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/routing/route_set.rb:676:in `call' 2014-04-24T17:34:53.599355+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/war den-1.2.3/lib/warden/manager.rb:34:in `catch' 2014-04-24T17:34:53.599357+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/war den-1.2.3/lib/warden/manager.rb:34:in `call' 2014-04-24T17:34:53.599363+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/head.rb:11:in `call' 2014-04-24T17:34:53.599353+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/war den-1.2.3/lib/warden/manager.rb:35:in `block in call' 2014-04-24T17:34:53.599359+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/etag.rb:23:in `call' 2014-04-24T17:34:53.599369+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/session/abstract/id.rb:225:in `context' 2014-04-24T17:34:53.599361+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/conditionalget.rb:35:in `call' 2014-04-24T17:34:53.599367+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/flash.rb:254:in `call' 2014-04-24T17:34:53.599370+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/session/abstract/id.rb:220:in `call' 2014-04-24T17:34:53.599365+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/params_parser.rb:27:in `call' 2014-04-24T17:34:53.599376+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/connection_adapters/abstract/connection_pool.r b:621:in `call' 2014-04-24T17:34:53.599372+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/cookies.rb:560:in `call' 2014-04-24T17:34:53.599374+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act iverecord-4.1.0/lib/active_record/query_cache.rb:36:in `call' 2014-04-24T17:34:53.599389+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' 2014-04-24T17:34:53.599380+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/callbacks.rb:82:in `run_callbacks' 2014-04-24T17:34:53.599384+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/remote_ip.rb:76:in `call' 2014-04-24T17:34:53.599382+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/callbacks.rb:27:in `call' 2014-04-24T17:34:53.599378+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' 2014-04-24T17:34:53.599391+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rai lties-4.1.0/lib/rails/rack/logger.rb:38:in `call_app' 2014-04-24T17:34:53.599386+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' 2014-04-24T17:34:53.599393+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rai lties-4.1.0/lib/rails/rack/logger.rb:20:in `block in call' 2014-04-24T17:34:53.599398+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/tagged_logging.rb:26:in `tagged' 2014-04-24T17:34:53.599396+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/tagged_logging.rb:68:in `block in tagged' 2014-04-24T17:34:53.599440+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/methodoverride.rb:21:in `call' 2014-04-24T17:34:53.599488+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/runtime.rb:17:in `call' 2014-04-24T17:34:53.599433+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/request_id.rb:21:in `call' 2014-04-24T17:34:53.599414+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rai lties-4.1.0/lib/rails/rack/logger.rb:20:in `call' 2014-04-24T17:34:53.599400+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/tagged_logging.rb:68:in `tagged' 2014-04-24T17:34:53.599493+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ionpack-4.1.0/lib/action_dispatch/middleware/static.rb:64:in `call' 2014-04-24T17:34:53.599491+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/act ivesupport-4.1.0/lib/active_support/cache/strategy/local_cache_middleware.rb:26: in `call' 2014-04-24T17:34:53.599495+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/sendfile.rb:112:in `call' 2014-04-24T17:34:53.599497+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rai lties-4.1.0/lib/rails/engine.rb:514:in `call' 2014-04-24T17:34:53.599499+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rai lties-4.1.0/lib/rails/application.rb:144:in `call' 2014-04-24T17:34:53.599501+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/lock.rb:17:in `call' 2014-04-24T17:34:53.599503+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/handler/webrick.rb:60:in `service' 2014-04-24T17:34:53.599502+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rac k-1.5.2/lib/rack/content_length.rb:14:in `call' 2014-04-24T17:34:53.599506+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/ webrick/httpserver.rb:94:in `run' 2014-04-24T17:34:53.599505+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/ webrick/httpserver.rb:138:in `service' 2014-04-24T17:34:53.599509+00:00 app[web.1]: 2014-04-24T17:34:53.599508+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/ webrick/server.rb:295:in `block in start_thread' 2014-04-24T17:34:53.599510+00:00 app[web.1]: 2014-04-24T17:34:53.588804+00:00 app[web.1]: 2014-04-24T17:34:53.588813+00:00 app[web.1]: Sent mail to tstevens_21@earthlink. net (66.7ms) 2014-04-24T17:34:53.595347+00:00 app[web.1]: Completed 500 Internal Server Error in 389ms 2014-04-24T17:34:53.600317+00:00 heroku[router]: at=info method=POST path=/users host=secret-brushlands-1375.herokuapp.com request_id=052e3b18-a726-49ae-b816-1b b5b13c8367 fwd="216.40.153.100" dyno=web.1 connect=3ms service=408ms status=500 bytes=1754
I am using Devise, and I have installed SendGrid on Heroku. Haven't seen the email confirmation yet. Any help appreciated.
Thank you,
原文:https://stackoverflow.com/questions/23277338
最满意答案
javascript对象
data
中的元素是对象而不是数组。 您可以通过调用console.log(data);
在控制台中进行检查console.log(data);
。请更换
options += '<option value="' + data[x]['id'] + '">' + data[x]['name'] + '</option>';
至
options += '<option value="' + data[x].id + '">' + data[x].name + '</option>';
Here is what I came up with, stripped, leaving the basics..
PHP (timezonesbycountry.php)
if (empty($_POST['country'])) { $timezones = DateTimeZone::listIdentifiers(DateTimeZone::ALL); }else{ $timezones = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $_POST['country']); } header('Content-Type: application/json'); echo json_encode($timezones);
JQUERY
$('#country').on('change', function (){ $.post( 'timezonesbycountry.php', {country: $(this).val()}) .done(function( data ) { var options = ''; $.each(data, function(k, v) { options += '<option value="' + v + '">' + v + '</option>'; }); $('#timezone').html(options); }); });
HTML
<select class="form-control" id="country" name="country" required> <option value="">Select One</option> <option value="AF">Afghanistan</option> <option value="US">United States</option> ...etc... </select> <select class="form-control" id="timezone" name="timezone" required> <option value="">Select One</option> ...etc... </select>
I use temp keys for all ajax requests, and sanitize the data in the php though...
$.post( '{$constant->get('AJAXPAGE')}/timezonesbycountry.php', {act: 'SOMETHING', ajaxkey: 'KEYHERE', country: $(this).val()})
I also pre-populate the country/timezone selects with php array's; you could pre-populate the timezones with the ajax instead though if your country select is static.
Thanks for the help, hopefully this help somebody else.
相关问答
更多-
通过本地客户端程序获取服务器mysql数据库信息[2023-04-27]
ajax -
尝试将x."question"更改为x.result.question 。 Try changing x."question" to x.result.question.
-
处理ajax错误(Handle ajax errors)[2023-01-01]
我认为使用getJSON没有可用的直接选项,而是使用ajax方法: $.ajax({ url: "test.php", dataType: "json", data: data, success: function(data){ }, error: function(data){ //ERROR HANDLING } }); I don't think there is a direct option available using getJSON, instead us ... -
您的代码中的问题是您的页面上有多个具有相同ID的跨度: totalvotes1和totalvotes2 。 所以当你做$('#totalvotes1').text(data); 浏览器不知道要改变哪一个。 为了解决这个问题,您可以考虑以下方法。 首先,通过添加产品的唯一键来更改跨度的ID。 要改变的第二件事是触发事件的链接的 ...
-
首先,当您从javascript发布到php时,请确保您的数据是json对象,不要通过JSON.stringify运行它。 $.ajax( { type:"POST", url:"
/valupd.php", dataType:"json", data:jsonObj //This should be an object }); 当你执行调用时,json对象中的属性将成为$ _POST php超全局中的入口。 所以给了一个看起来像的帖子 {"ID":"1 ... -
javascript对象data中的元素是对象而不是数组。 您可以通过调用console.log(data);在控制台中进行检查console.log(data); 。 请更换 options += ''; 至 options += ''; ...
-
更正了键和值(颜色和动物)之间切换的代码: $obj = json_decode($json, true); if(array_key_exists($m_decoded, $obj)){ print $obj[$m_decoded]; } else { print array_search($m_decoded, $obj); } 在第二种情况下,你必须在$obj搜索$m_decoded ,而不是$obj[$m_decoded] 。 Corrected code for toggle ...
-
我确实在我的js上使用这个代码解决了这个问题 这就是我收集我创建对象的数据的方式 jsonObj={"postid":postid,"value":value}; var jsonString=JSON.stringify(jsonObj); 现在我用ajax发送了对象 $.ajax({ type: 'POST', url: siteurl+'/wp-content/themes/crm/modules/update_lead.php', dataType : 'json', data: ...
-
您需要在JavaScript回调中处理来自php的结果。 所以你可以这样做: $.ajax({ url: "index.php", type: 'POST', data :{text : 123}, dataType: 'json', complete: function(data){ console.log(data.responseText) //(not sure why responseText is necessary) } }); ...
-
因为你正在使用'Content-Type:application / json'你需要提供json数组而不是php数组所以首先得到一个php格式的数组 $datastring= array( "EmailAddress"=> "john.smith@acmeconsulting.co", "ActivityEvent"=> 112, "ActivityNote"=> "Note for the activity", "ActivityDateTime"=> "yyyy-mm-dd hh:mm:ss", "F ...