I have set up a new rails project with user registration through devise gem. However, I am facing issues in the user registration. I tried using both sendgrid and gmail settings using the setup_mail.rb file below.
I have browsed through all the stackoverflow questions related to emails not working with devise but to no avail.
The errors I get are
1.) When using the sendgrid settings
Net::SMTPAuthenticationError in Devise::RegistrationsController#create
535 Authentication failed: account disabled
2.) When using the gmail settings. I have enabled the less secure apps in google for my account.
The relevant files are
Net::SMTPAuthenticationError in Devise::RegistrationsController#create
534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbtq-
config/initializers/setup_mail.rb
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => 'smtp.sendgrid.net',
:port => 587,
:authentication => :plain,
:user_name => 'appname#heroku.com',
:password => 'password',
:domain => 'heroku.com',
:enable_starttls_auto => true
}
# ActionMailer::Base.smtp_settings = {
# :address => 'smtp.gmail.com',
# :port => 587,
# :authentication => :plain,
# :user_name => 'user#gmail.com',
# :password => 'password',
# :domain => 'gmail.com',
# :enable_starttls_auto => true
# }
config/environments/development.rb
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
config.cache_classes = false
config.eager_load = false
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.active_support.deprecation = :log
config.active_record.migration_error = :page_load
config.assets.debug = true
config.assets.digest = true
config.assets.raise_runtime_errors = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options = {:host => 'localhost:3000'}
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.default :charset => "utf-8"
end
Output from the development log
Devise::Mailer#confirmation_instructions: processed outbound mail in 8.3ms
Sent mail to w#ew.com (2360.5ms)
Date: Thu, 08 Oct 2015 14:59:36 +0530
From: please-change-me-at-config-initializers-devise#example.com
Reply-To: please-change-me-at-config-initializers-devise#example.com
To: w#ew.com
Message-ID: <5616378020219_5ae128535fc52153#Battosai.mail>
Subject: Confirmation instructions
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
<p>Welcome w#ew.com!</p>
<p>You can confirm your account email through the link below:</p>
<p>Confirm my account</p>
[1m[36m (0.7ms)[0m [1mrollback transaction[0m
Completed 500 Internal Server Error in 2491ms (ActiveRecord: 1.3ms)
Net::SMTPAuthenticationError (534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbu-7
):
/home/ankit/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/smtp.rb:976:in `check_auth_response'
/home/ankit/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/smtp.rb:740:in `auth_plain'
/home/ankit/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/smtp.rb:732:in `authenticate'
/home/ankit/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/smtp.rb:567:in `do_start'
/home/ankit/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/net/smtp.rb:520:in `start'
mail (2.6.3) lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
mail (2.6.3) lib/mail/message.rb:2141:in `do_delivery'
mail (2.6.3) lib/mail/message.rb:236:in `block in deliver'
actionmailer (4.2.4) lib/action_mailer/base.rb:543:in `block in deliver_mail'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in `instrument'
actionmailer (4.2.4) lib/action_mailer/base.rb:541:in `deliver_mail'
mail (2.6.3) lib/mail/message.rb:236:in `deliver'
actionmailer (4.2.4) lib/action_mailer/message_delivery.rb:85:in `deliver_now'
devise (3.5.2) lib/devise/models/authenticatable.rb:170:in `send_devise_notification'
devise (3.5.2) lib/devise/models/confirmable.rb:116:in `send_confirmation_instructions'
devise (3.5.2) lib/devise/models/confirmable.rb:172:in `send_on_create_confirmation_instructions'
activesupport (4.2.4) lib/active_support/callbacks.rb:432:in `block in make_lambda'
activesupport (4.2.4) lib/active_support/callbacks.rb:228:in `call'
activesupport (4.2.4) lib/active_support/callbacks.rb:228:in `block in halting_and_conditional'
activesupport (4.2.4) lib/active_support/callbacks.rb:506:in `call'
activesupport (4.2.4) lib/active_support/callbacks.rb:506:in `block in call'
activesupport (4.2.4) lib/active_support/callbacks.rb:506:in `each'
activesupport (4.2.4) lib/active_support/callbacks.rb:506:in `call'
activesupport (4.2.4) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
activesupport (4.2.4) lib/active_support/callbacks.rb:778:in `_run_create_callbacks'
activerecord (4.2.4) lib/active_record/callbacks.rb:306:in `_create_record'
activerecord (4.2.4) lib/active_record/timestamp.rb:57:in `_create_record'
activerecord (4.2.4) lib/active_record/persistence.rb:504:in `create_or_update'
activerecord (4.2.4) lib/active_record/callbacks.rb:302:in `block in create_or_update'
activesupport (4.2.4) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.4) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.4) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
activesupport (4.2.4) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.4) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.4) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
activesupport (4.2.4) lib/active_support/callbacks.rb:778:in `_run_save_callbacks'
activerecord (4.2.4) lib/active_record/callbacks.rb:302:in `create_or_update'
activerecord (4.2.4) lib/active_record/persistence.rb:120:in `save'
activerecord (4.2.4) lib/active_record/validations.rb:37:in `save'
activerecord (4.2.4) lib/active_record/attribute_methods/dirty.rb:21:in `save'
activerecord (4.2.4) lib/active_record/transactions.rb:286:in `block (2 levels) in save'
activerecord (4.2.4) lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
activerecord (4.2.4) lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
activerecord (4.2.4) lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
activerecord (4.2.4) lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
activerecord (4.2.4) lib/active_record/transactions.rb:220:in `transaction'
activerecord (4.2.4) lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
activerecord (4.2.4) lib/active_record/transactions.rb:286:in `block in save'
activerecord (4.2.4) lib/active_record/transactions.rb:301:in `rollback_active_record_state!'
activerecord (4.2.4) lib/active_record/transactions.rb:285:in `save'
devise (3.5.2) app/controllers/devise/registrations_controller.rb:17:in `create'
actionpack (4.2.4) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.2.4) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.4) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.4) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.4) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.4) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.4) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
activesupport (4.2.4) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.4) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.4) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
activesupport (4.2.4) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
activesupport (4.2.4) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.4) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.4) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.4) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.4) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.4) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.4) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.4) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.4) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.4) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:76:in `call'
actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:76:in `dispatch'
actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:45:in `serve'
actionpack (4.2.4) lib/action_dispatch/routing/mapper.rb:49:in `serve'
actionpack (4.2.4) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.4) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.4) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:821:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.6.4) lib/rack/etag.rb:24:in `call'
rack (1.6.4) lib/rack/conditionalget.rb:38:in `call'
rack (1.6.4) lib/rack/head.rb:13:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.4) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
activerecord (4.2.4) lib/active_record/migration.rb:377:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.4) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.4) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.4) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
web-console (2.2.1) lib/web_console/middleware.rb:39:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.4) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.4) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.4) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.4) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.4) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/static.rb:116:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.4) lib/rails/engine.rb:518:in `call'
railties (4.2.4) lib/rails/application.rb:165:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
/home/ankit/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
/home/ankit/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
/home/ankit/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
Rendered /home/ankit/.rvm/gems/ruby-2.2.2/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_source.erb (12.8ms)
Rendered /home/ankit/.rvm/gems/ruby-2.2.2/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (4.7ms)
Rendered /home/ankit/.rvm/gems/ruby-2.2.2/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.8ms)
Rendered /home/ankit/.rvm/gems/ruby-2.2.2/gems/actionpack-4.2.4/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (37.7ms)
Rendered /home/ankit/.rvm/gems/ruby-2.2.2/gems/web-console-2.2.1/lib/web_console/templates/_markup.html.erb (0.7ms)
Rendered /home/ankit/.rvm/gems/ruby-2.2.2/gems/web-console-2.2.1/lib/web_console/templates/_inner_console_markup.html.erb within layouts/inlined_string (0.3ms)
Rendered /home/ankit/.rvm/gems/ruby-2.2.2/gems/web-console-2.2.1/lib/web_console/templates/_prompt_box_markup.html.erb within layouts/inlined_string (0.5ms)
Rendered /home/ankit/.rvm/gems/ruby-2.2.2/gems/web-console-2.2.1/lib/web_console/templates/style.css.erb within layouts/inlined_string (0.4ms)
Rendered /home/ankit/.rvm/gems/ruby-2.2.2/gems/web-console-2.2.1/lib/web_console/templates/console.js.erb within layouts/javascript (19.0ms)
Rendered /home/ankit/.rvm/gems/ruby-2.2.2/gems/web-console-2.2.1/lib/web_console/templates/main.js.erb within layouts/javascript (0.3ms)
Rendered /home/ankit/.rvm/gems/ruby-2.2.2/gems/web-console-2.2.1/lib/web_console/templates/error_page.js.erb within layouts/javascript (0.6ms)
Rendered /home/ankit/.rvm/gems/ruby-2.2.2/gems/web-console-2.2.1/lib/web_console/templates/index.html.erb (38.7ms)
Turn on "access to less secure app" for gmail from which you are sending mail.
https://www.google.com/settings/u/1/security/lesssecureapps.
Related
I'm experiencing some kind of regression error involving Devise and it's ability to send email to a user during the registration. I'm new to Rails and once I got Devise running, I kind of stopped experimenting with the registration portion. I recently upgraded my ruby version, wiped my development database, and when I tried to recreate some users I got this error:
Started POST "/users" for ::1 at 2016-10-02 09:32:34 -0400
Processing by DeviseInvitable::RegistrationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"SFT9EQX83Aqg5jcdox1mLzlEGGRxUnvSngLgc08Hgysctg0BOI7Yrxv9UbWIjuS80Bf+hYHj0VA6B0LOMxTnLw==", "user"=>{"email"=>"user.name+test1#gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"}
User Load (154.7ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'user.name+test1#gmail.com' ORDER BY `users`.`id` ASC LIMIT 1
(0.2ms) BEGIN
User Exists (3.3ms) SELECT 1 AS one FROM `users` WHERE `users`.`email` = BINARY 'user.name+test1#gmail.com' LIMIT 1
SQL (25.0ms) INSERT INTO `users` (`email`, `encrypted_password`, `created_at`, `updated_at`, `confirmation_token`, `confirmation_sent_at`) VALUES ('user.name+test1#gmail.com', '$2a$10$20khSPmwRsCjxkiyjhiRE.BrYzV7Zu.6OY8rJnyLFB3Ju73PdLSLq', '2016-10-02 13:32:34', '2016-10-02 13:32:34', 'X2SBSZKmqTiV_As--ibW', '2016-10-02 13:32:34')
(1.3ms) COMMIT
Rendered devise/mailer/confirmation_instructions.html.erb (1.0ms)
Devise::Mailer#confirmation_instructions: processed outbound mail in 173.1ms
Sent mail to user.name+test1#gmail.com (596.2ms)
Date: Sun, 02 Oct 2016 09:32:34 -0400
From: user.name#gmail.com
Reply-To: user.name#gmail.com
To: user.name+test1#gmail.com
Message-ID: <57f10c72dbcb5_c783ffd99fa77c0174cb#uname.ad.mdp.com.mail>
Subject: Confirmation instructions
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
<p>Welcome user.name+test1#gmail.com!</p>
<p>You can confirm your account email through the link below:</p>
<p>Confirm my account</p>
Completed 500 Internal Server Error in 1063ms (ActiveRecord: 184.5ms)
EOFError - end of file reached:
/Users/uname/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/protocol.rb:153:in `rbuf_fill'
/Users/uname/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/protocol.rb:134:in `readuntil'
/Users/uname/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/protocol.rb:144:in `readline'
/Users/uname/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/smtp.rb:945:in `recv_response'
/Users/uname/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/smtp.rb:931:in `block in getok'
/Users/uname/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/smtp.rb:955:in `critical'
/Users/uname/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/smtp.rb:929:in `getok'
/Users/uname/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/smtp.rb:830:in `helo'
/Users/uname/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/smtp.rb:604:in `do_helo'
/Users/uname/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/smtp.rb:556:in `do_start'
/Users/uname/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/smtp.rb:520:in `start'
mail (2.6.4) lib/mail/network/delivery_methods/smtp.rb:113:in `deliver!'
mail (2.6.4) lib/mail/message.rb:2149:in `do_delivery'
mail (2.6.4) lib/mail/message.rb:237:in `block in deliver'
actionmailer (4.2.3) lib/action_mailer/base.rb:543:in `block in deliver_mail'
activesupport (4.2.3) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.3) lib/active_support/notifications.rb:164:in `instrument'
actionmailer (4.2.3) lib/action_mailer/base.rb:541:in `deliver_mail'
mail (2.6.4) lib/mail/message.rb:237:in `deliver'
actionmailer (4.2.3) lib/action_mailer/message_delivery.rb:85:in `deliver_now'
devise (4.2.0) lib/devise/models/authenticatable.rb:191:in `send_devise_notification'
devise (4.2.0) lib/devise/models/confirmable.rb:117:in `send_confirmation_instructions'
devise (4.2.0) lib/devise/models/confirmable.rb:179:in `send_on_create_confirmation_instructions'
activesupport (4.2.3) lib/active_support/callbacks.rb:430:in `block in make_lambda'
activesupport (4.2.3) lib/active_support/callbacks.rb:251:in `block in conditional'
activesupport (4.2.3) lib/active_support/callbacks.rb:504:in `block in call'
activesupport (4.2.3) lib/active_support/callbacks.rb:504:in `call'
activesupport (4.2.3) lib/active_support/callbacks.rb:88:in `run_callbacks'
activerecord (4.2.3) lib/active_record/transactions.rb:314:in `committed!'
activerecord (4.2.3) lib/active_record/connection_adapters/abstract/transaction.rb:89:in `commit_records'
activerecord (4.2.3) lib/active_record/connection_adapters/abstract/transaction.rb:153:in `commit'
activerecord (4.2.3) lib/active_record/connection_adapters/abstract/transaction.rb:175:in `commit_transaction'
activerecord (4.2.3) lib/active_record/connection_adapters/abstract/transaction.rb:194:in `within_new_transaction'
activerecord (4.2.3) lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
activerecord (4.2.3) lib/active_record/transactions.rb:220:in `transaction'
activerecord (4.2.3) lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
activerecord (4.2.3) lib/active_record/transactions.rb:286:in `block in save'
activerecord (4.2.3) lib/active_record/transactions.rb:301:in `rollback_active_record_state!'
activerecord (4.2.3) lib/active_record/transactions.rb:285:in `save'
devise (4.2.0) app/controllers/devise/registrations_controller.rb:17:in `create'
actionpack (4.2.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.2.3) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.3) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.3) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.3) lib/active_support/callbacks.rb:115:in `call'
activesupport (4.2.3) lib/active_support/callbacks.rb:553:in `block (2 levels) in compile'
activesupport (4.2.3) lib/active_support/callbacks.rb:503:in `call'
activesupport (4.2.3) lib/active_support/callbacks.rb:88:in `run_callbacks'
actionpack (4.2.3) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.3) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.3) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.3) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.3) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.3) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.3) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.3) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.3) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.3) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.3) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.3) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.3) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.3) lib/action_dispatch/routing/route_set.rb:76:in `dispatch'
actionpack (4.2.3) lib/action_dispatch/routing/route_set.rb:45:in `serve'
actionpack (4.2.3) lib/action_dispatch/routing/mapper.rb:49:in `serve'
actionpack (4.2.3) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.3) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.3) lib/action_dispatch/routing/route_set.rb:821:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
rack (1.6.4) lib/rack/etag.rb:24:in `call'
rack (1.6.4) lib/rack/conditionalget.rb:38:in `call'
rack (1.6.4) lib/rack/head.rb:13:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.3) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
activerecord (4.2.3) lib/active_record/migration.rb:377:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.3) lib/active_support/callbacks.rb:84:in `run_callbacks'
actionpack (4.2.3) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
better_errors (2.1.1) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:57:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.3) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.3) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.3) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.3) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.3) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.3) lib/rails/rack/logger.rb:20:in `call'
quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets'
actionpack (4.2.3) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.3) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/static.rb:116:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.3) lib/rails/engine.rb:518:in `call'
railties (4.2.3) lib/rails/application.rb:165:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
/Users/uname/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
/Users/uname/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
/Users/uname/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
I am using gmail as my smtp server for dev & test environments. This was working fine - I was able to receive the emails at 'user.name+test1#gmail.com' (well, at the real version of that email addr) earlier.
I can't understand from the error message exactly what the problem is though. It looks like Devise was able to create the confirmation email:
Rendered devise/mailer/confirmation_instructions.html.erb (1.0ms)
Then it appears to say that the email was sent
Devise::Mailer#confirmation_instructions: processed outbound mail in 173.1ms
Sent mail to user.name+test1#gmail.com (596.2ms)
But something is reporting an EOF error. Presumably this is ruby's network adapter complaining that it expected more of the file being sent (the email data?), but ran out prematurely:
Completed 500 Internal Server Error in 1063ms (ActiveRecord: 184.5ms)
EOFError - end of file reached:
/Users/uname/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/protocol.rb:153:in `rbuf_fill'
/Users/uname/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/net/protocol.rb:134:in `readuntil'
But this is one of those things where I don't think I've changed any of the Devise configurations or views since Devise was working so I'd be surprised if the answer involved changing existing configs.
Has anyone experienced anything like this before? This post seems very similar (Ruby mailer is coming up with an EOFError) but didn't get any responses.
ALSO: I just saw that a record had been added to the User table for user.name+test1#gmail.com. There is a field there for the confirmation token and when I hit http://localhost:3000/users/confirmation?confirmation_token=[token from db] the user was confirmed and I was able to log in with them. So this error really must be localized to sending the confirmation email (which, again, never arrived in my inbox).
Edit: Here is my mailer config:
app/config/environments/development.rb
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: Rails.application.secrets.email_provider_smtp_domain,
authentication: "plain",
enable_starttls_auto: true,
user_name: Rails.application.secrets.email_provider_username,
password: Rails.application.secrets.email_provider_password
}
# ActionMailer Config
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
# Send email in development mode?
config.action_mailer.perform_deliveries = true
config.action_mailer.default :charset => "utf-8"
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
I can't find a solution. I would like to create new User in my web application (with Devise). Please, read the notes below:
My current OS: Ubuntu 15
Previous OS: Linux Mint
(On Mac OS X it works correctly)
Terminal log:
Started POST "/users" for 127.0.0.1 at 2016-03-04 00:40:32 +0300
Processing by Users::RegistrationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"OmTevxMT8IYxO8fcWHJU75gsLhVlj6/dLctvU2PhIWnlsEZ2B0p0iCQClVmPbRKBBauBKfjwv1hRnP8kTC0sxg==", "user"=>{"name"=>"test", "surname"=>"test", "email"=>"test#test.ru", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Зарегистрироваться"}
(0.3ms) BEGIN
User Exists (0.7ms) SELECT 1 AS one FROM `users` WHERE `users`.`email` = BINARY 'test#test.ru' LIMIT 1
SQL (0.6ms) INSERT INTO `users` (`email`, `encrypted_password`, `name`, `surname`, `created_at`, `updated_at`) VALUES ('test#test.ru', '$2a$10$sY490xgy8sHCFJxfY2B80OSFV7s.p0qg8R03ZPLGjzGYqou8Lz6xC', 'test', 'test', '2016-03-03 21:40:32.488474', '2016-03-03 21:40:32.488474')
(44.3ms) COMMIT
Completed 500 Internal Server Error in 201ms
ArgumentError - argument out of range:
activesupport (4.2.0) lib/active_support/values/time_zone.rb:350:in `parse'
activesupport (4.2.0) lib/active_support/core_ext/string/zones.rb:9:in `in_time_zone'
activerecord (4.2.0) lib/active_record/attribute_methods/time_zone_conversion.rb:15:in `type_cast_from_user'
activerecord (4.2.0) lib/active_record/attribute.rb:100:in `type_cast'
activerecord (4.2.0) lib/active_record/attribute.rb:42:in `original_value'
activerecord (4.2.0) lib/active_record/attribute.rb:37:in `value'
activerecord (4.2.0) lib/active_record/attribute.rb:46:in `value_for_database'
activerecord (4.2.0) lib/active_record/attribute_methods/dirty.rb:164:in `store_original_raw_attribute'
activerecord (4.2.0) lib/active_record/attribute_methods/dirty.rb:93:in `write_attribute'
activerecord (4.2.0) lib/active_record/attribute_methods.rb:50:in `__temp__c6163747f5379676e6f596e6f59607'
devise (3.5.5) lib/devise/models/trackable.rb:24:in `update_tracked_fields'
devise (3.5.5) lib/devise/models/trackable.rb:32:in `update_tracked_fields!'
devise (3.5.5) lib/devise/hooks/trackable.rb:7:in `block in '
warden (1.2.6) lib/warden/hooks.rb:14:in `block in _run_callbacks'
warden (1.2.6) lib/warden/hooks.rb:9:in `_run_callbacks'
warden (1.2.6) lib/warden/manager.rb:51:in `_run_callbacks'
warden (1.2.6) lib/warden/proxy.rb:179:in `set_user'
devise (3.5.5) lib/devise/controllers/sign_in_out.rb:43:in `sign_in'
devise (3.5.5) app/controllers/devise/registrations_controller.rb:106:in `sign_up'
devise (3.5.5) app/controllers/devise/registrations_controller.rb:22:in `create'
app/controllers/users/registrations_controller.rb:12:in `create'
actionpack (4.2.0) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.2.0) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.0) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.0) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.0) lib/active_support/callbacks.rb:151:in `block in halting_and_conditional'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:234:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:234:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0) lib/active_support/callbacks.rb:151:in `block in halting_and_conditional'
activesupport (4.2.0) lib/active_support/callbacks.rb:151:in `block in halting_and_conditional'
activesupport (4.2.0) lib/active_support/callbacks.rb:92:in `_run_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:734:in `_run_process_action_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.0) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.0) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.2.0) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.0) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.0) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.0) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.0) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.0) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.2.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.0) lib/action_controller/metal.rb:236:in `block in action'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:42:in `serve'
actionpack (4.2.0) lib/action_dispatch/routing/mapper.rb:49:in `serve'
actionpack (4.2.0) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.0) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.0) lib/action_dispatch/routing/route_set.rb:802:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
rack (1.6.4) lib/rack/etag.rb:24:in `call'
rack (1.6.4) lib/rack/conditionalget.rb:38:in `call'
rack (1.6.4) lib/rack/head.rb:13:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.0) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:647:in `call'
activerecord (4.2.0) lib/active_record/migration.rb:378:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.0) lib/active_support/callbacks.rb:88:in `_run_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:734:in `_run_call_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
better_errors (2.1.1) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:57:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.0) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.0) lib/rails/rack/logger.rb:20:in `call'
quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets'
actionpack (4.2.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.0) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/static.rb:113:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.0) lib/rails/engine.rb:518:in `call'
railties (4.2.0) lib/rails/application.rb:164:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
puma (2.16.0) lib/puma/server.rb:557:in `handle_request'
puma (2.16.0) lib/puma/server.rb:404:in `process_client'
puma (2.16.0) lib/puma/server.rb:270:in `block in run'
puma (2.16.0) lib/puma/thread_pool.rb:106:in `block in spawn_thread'
I have added changes to my model, but my error is the same:
class Something < ActiveRecord::Base
validate :important_date_is_valid_datetime, on: :create
validates :important_date, presence: true
private
def important_date_is_valid_datetime
if (DateTime.parse(important_date.to_s()) rescue ArgumentError) == ArgumentError then
errors.add(:important_date, 'must be a valid datetime')
end
end
end
Also, I have added the next code in my form:
class Something < ActiveRecord::Base
validate :important_date_is_valid_datetime, on: :create
validates :important_date, presence: true
private
def important_date_is_valid_datetime
if (DateTime.parse(important_date.to_s()) rescue ArgumentError) == ArgumentError then
errors.add(:important_date, 'must be a valid datetime')
end
end
end
I am trying to check if an image is available and if not to return a generic image. I was hoping that this code would do the trick but it is telling me the method doesn't exist
Controller
#products = Supplier
.joins(:variants)
.joins('INNER JOIN products on products.id = variants.product_id')
.where('suppliers.id = ?', params[:id])
.group('suppliers.id','products.id','products.name')
.pluck('suppliers.id as supplier_id','products.id as prod_id','products.name as prod_name')
View
- #products.each_with_index do |product, i|
.product-list.grid-block
.small-8.grid-content.text-center
%h4= product[1].titlecase
- #sizes.each do |size|
- if size[0] == product[0]
= link_to size[1], product_path(product[0]), class: 'hollow button tiny'
%small= number_to_currency(size[2])
.small-4
= link_to product_path(product, supplier_id: #supplier), title: product[1] do
= product[1].image_available
Model
def image_available(product)
(Rails.application.assets.find_asset("products/#{product.downcase.tr(' ', '-')}.jpg").nil?) ?
ActionController::Base.helpers.image_tag('products/generic.jpg', size: '50', alt: product.titlecase, title: product.titlecase) :
ActionController::Base.helpers.image_tag("products/#{product.downcase.tr(' ', '-')}.jpg", size: '50', alt: product.titlecase, title: product.titlecase)
end
Error Log
Started GET "/suppliers/1" for 127.0.0.1 at 2016-01-06 20:31:53 +1100
Processing by SuppliersController#show as HTML
Parameters: {"id"=>"1"}
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]]
Supplier Load (0.3ms) SELECT "suppliers".* FROM "suppliers" WHERE "suppliers"."id" = $1 LIMIT 1 [["id", 1]]
(1.3ms) SELECT products.id as prod_id, products.name as prod_name FROM "suppliers" INNER JOIN "variant_suppliers" ON "variant_suppliers"."supplier_id" = "suppliers"."id" INNER JOIN "variants" ON "variants"."id" = "variant_suppliers"."variant_id" INNER JOIN products on products.id = variants.product_id WHERE (suppliers.id = '1') GROUP BY products.id, products.name
(2.8ms) SELECT products.id as prod_id, LEFT(variant_properties.description,1) as short_desc, variants.price as price FROM "suppliers" INNER JOIN "variant_suppliers" ON "variant_suppliers"."supplier_id" = "suppliers"."id" INNER JOIN variants on variants.id = variant_suppliers.variant_id INNER JOIN products on products.id = variants.product_id INNER JOIN variant_properties on variant_properties.variant_id = variants.id INNER JOIN properties on properties.id = variant_properties.property_id AND properties.display_name ='Size' WHERE (suppliers.id = '1')
Rendered suppliers/show.html.haml within layouts/application (4.5ms)
Completed 500 Internal Server Error in 74ms (ActiveRecord: 12.0ms)
NoMethodError - undefined method `image_available' for "Bubble Tea":String:
app/views/suppliers/show.html.haml:12:in `block (2 levels) in _app_views_suppliers_show_html_haml___1626246587383268315_70147714796320'
haml (4.0.7) lib/haml/helpers.rb:368:in `block in capture_haml'
haml (4.0.7) lib/haml/helpers.rb:608:in `with_haml_buffer'
haml (4.0.7) lib/haml/helpers.rb:364:in `capture_haml'
haml (4.0.7) lib/haml/helpers/xss_mods.rb:61:in `capture_haml_with_haml_xss'
haml (4.0.7) lib/haml/helpers/action_view_mods.rb:45:in `capture_with_haml'
actionview (4.2.4) lib/action_view/helpers/tag_helper.rb:106:in `content_tag'
haml (4.0.7) lib/haml/helpers/action_view_mods.rb:69:in `content_tag_with_haml'
actionview (4.2.4) lib/action_view/helpers/url_helper.rb:184:in `link_to'
app/views/suppliers/show.html.haml:11:in `block in _app_views_suppliers_show_html_haml___1626246587383268315_70147714796320'
app/views/suppliers/show.html.haml:2:in `_app_views_suppliers_show_html_haml___1626246587383268315_70147714796320'
actionview (4.2.4) lib/action_view/template.rb:145:in `block in render'
activesupport (4.2.4) lib/active_support/notifications.rb:166:in `instrument'
actionview (4.2.4) lib/action_view/template.rb:333:in `instrument'
actionview (4.2.4) lib/action_view/template.rb:143:in `render'
actionview (4.2.4) lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template'
actionview (4.2.4) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in `instrument'
actionview (4.2.4) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
actionview (4.2.4) lib/action_view/renderer/template_renderer.rb:53:in `block in render_template'
actionview (4.2.4) lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
actionview (4.2.4) lib/action_view/renderer/template_renderer.rb:52:in `render_template'
actionview (4.2.4) lib/action_view/renderer/template_renderer.rb:14:in `render'
actionview (4.2.4) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionview (4.2.4) lib/action_view/renderer/renderer.rb:23:in `render'
actionview (4.2.4) lib/action_view/rendering.rb:100:in `_render_template'
actionpack (4.2.4) lib/action_controller/metal/streaming.rb:217:in `_render_template'
actionview (4.2.4) lib/action_view/rendering.rb:83:in `render_to_body'
actionpack (4.2.4) lib/action_controller/metal/rendering.rb:32:in `render_to_body'
actionpack (4.2.4) lib/action_controller/metal/renderers.rb:37:in `render_to_body'
actionpack (4.2.4) lib/abstract_controller/rendering.rb:25:in `render'
actionpack (4.2.4) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
activesupport (4.2.4) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/Users/paulmcguane/.rbenv/versions/2.2.1/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'
activesupport (4.2.4) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
activerecord (4.2.4) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:43:in `render'
actionpack (4.2.4) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (4.2.4) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (4.2.4) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.4) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.4) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.4) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.4) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
activesupport (4.2.4) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.4) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
activesupport (4.2.4) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
activesupport (4.2.4) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.4) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.4) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.4) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.4) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.4) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.4) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.4) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.4) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.4) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:76:in `dispatch'
actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:45:in `serve'
actionpack (4.2.4) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.4) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:821:in `call'
bullet (4.14.10) lib/bullet/rack.rb:12:in `call'
warden (1.2.4) lib/warden/manager.rb:35:in `block in call'
warden (1.2.4) lib/warden/manager.rb:34:in `call'
rack (1.6.4) lib/rack/etag.rb:24:in `call'
rack (1.6.4) lib/rack/conditionalget.rb:25:in `call'
rack (1.6.4) lib/rack/head.rb:13:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.4) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
activerecord (4.2.4) lib/active_record/migration.rb:377:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.4) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.4) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.4) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
better_errors (2.1.1) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:57:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.4) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.4) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.4) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.4) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.4) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/static.rb:116:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.4) lib/rails/engine.rb:518:in `call'
railties (4.2.4) lib/rails/application.rb:165:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
puma (2.15.3) lib/puma/server.rb:541:in `handle_request'
puma (2.15.3) lib/puma/server.rb:388:in `process_client'
puma (2.15.3) lib/puma/server.rb:270:in `block in run'
puma (2.15.3) lib/puma/thread_pool.rb:106:in `block in spawn_thread'
Started POST "/__better_errors/e4e72c26f6073831/variables" for 127.0.0.1 at 2016-01-06 20:31:54 +1100
First, you're applying the method to product[1] not to product. product[1] is a string and you don't have that method defined for the String class.
There are other issues with the code as well.... you specify the method is "in the Model" but you don't explicitly say which model. You pass an argument to the method (product) but you don't pass an argument when you actually use it in the view.
You may actually want to call it something like...
= product.image_available[product.prod_name]
I use gem activeadmin. Every time, when I login, I get the error.
ActionController::ActionControllerError in ActiveAdmin::Devise::SessionsController#new
raise ActionControllerError.new("Cannot redirect to nil!") unless options
on url: http://localhost:3000/admin/login
But if I go to this url http://localhost:3000/admin
activeadmin is working, but writing You are already signed in.
routes.rb
ActiveAdmin.routes(self)
#settings activeadmin
devise_for :admin_users, ActiveAdmin::Devise.config
#settings devise
devise_for :users, controllers: { sessions: "sessions", registrations: "registrations" }
get 'persons/profile'
application_controller.rb
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
def after_sign_in_path_for(resource)
request.referer
end
def after_sign_out_path_for(resource_or_scope)
root_path
end
log
Started GET "/admin/login" for 127.0.0.1 at 2015-05-06 10:49:04 +0600
Processing by ActiveAdmin::Devise::SessionsController#new as HTML
AdminUser Load (0.3ms) SELECT "admin_users".* FROM "admin_users" WHERE "admin_users"."id" = $1 ORDER BY "admin_users"."id" ASC LIMIT 1 [["id", 2]]
Redirected to
Completed 500 Internal Server Error in 4ms (ActiveRecord: 0.3ms)
ActionController::ActionControllerError (Cannot redirect to nil!):
actionpack (4.2.1) lib/action_controller/metal/redirecting.rb:70:in `redirect_to'
actionpack (4.2.1) lib/action_controller/metal/flash.rb:57:in `redirect_to'
actionpack (4.2.1) lib/action_controller/metal/instrumentation.rb:64:in `block in redirect_to'
activesupport (4.2.1) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.1) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.1) lib/action_controller/metal/instrumentation.rb:63:in `redirect_to'
devise (3.4.1) app/controllers/devise_controller.rb:110:in `require_no_authentication'
activesupport (4.2.1) lib/active_support/callbacks.rb:432:in `block in make_lambda'
activesupport (4.2.1) lib/active_support/callbacks.rb:145:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:145:in `block in halting_and_conditional'
activesupport (4.2.1) lib/active_support/callbacks.rb:504:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:504:in `block in call'
activesupport (4.2.1) lib/active_support/callbacks.rb:504:in `each'
activesupport (4.2.1) lib/active_support/callbacks.rb:504:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:92:in `_run_callbacks'
activesupport (4.2.1) lib/active_support/callbacks.rb:776:in `_run_process_action_callbacks'
activesupport (4.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.1) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.1) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.1) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.1) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.1) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
searchkick (0.8.7) lib/searchkick/logging.rb:107:in `process_action'
activerecord (4.2.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.1) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.1) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.1) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.1) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.1) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:74:in `call'
actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:43:in `serve'
actionpack (4.2.1) lib/action_dispatch/routing/mapper.rb:49:in `serve'
actionpack (4.2.1) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.1) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.1) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:819:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.6.0) lib/rack/etag.rb:24:in `call'
rack (1.6.0) lib/rack/conditionalget.rb:25:in `call'
rack (1.6.0) lib/rack/head.rb:13:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.0) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.0) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.1) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:649:in `call'
activerecord (4.2.1) lib/active_record/migration.rb:378:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `_run_callbacks'
activesupport (4.2.1) lib/active_support/callbacks.rb:776:in `_run_call_callbacks'
activesupport (4.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
web-console (2.1.2) lib/web_console/middleware.rb:37:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.1) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.1) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.0) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.0) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.0) lib/rack/lock.rb:17:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/static.rb:113:in `call'
rack (1.6.0) lib/rack/sendfile.rb:113:in `call'
railties (4.2.1) lib/rails/engine.rb:518:in `call'
railties (4.2.1) lib/rails/application.rb:164:in `call'
rack (1.6.0) lib/rack/lock.rb:17:in `call'
rack (1.6.0) lib/rack/content_length.rb:15:in `call'
rack (1.6.0) lib/rack/handler/webrick.rb:89:in `service'
/home/maratovich/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
/home/maratovich/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
/home/maratovich/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
Found many issues but not helped me
YES Solved...
First:
Method after_sign_in_path_for should be in module protected
Second in this method I added root_path || user_admin_path
Result is:
protected
def after_sign_in_path_for(resource_or_scope)
root_path || user_admin_path
end
So I am running into an interesting error I have never seen before. I am trying to set up mail in development so that I can send actual emails to my self. So lets go through how I have set up mail
I have an initializer called setup_mail.rb
ActionMailer::Base.smtp_settings = {
:address => 'smptp.gmail.com',
:port => 587,
:domain => "gmail.com",
:user_name => Figaro.env.EMAIL,
:password => Figaro.env.PASSWORD,
:authentication => 'plain',
:enable_starttls_auto => true
}
ActionMailer::Base.default_url_options[:host] = Figaro.env.HOST
From there we have a mailer class in the mailers directory called user_mailer.rb
class UserMailer < ActionMailer::Base
default from: "AisisPlatForm#AisisPlanner.com"
def registration_confirmation(user)
#user = user
mail(:to => "#{user.first_name} <#{user.email}>", :subject => 'Welcome to AisisPlatform!')
end
def password_reset(user)
#user = user
mail(:to => "#{user.first_name} <#{user.email}>", :subject => 'Password Reset (AisisPlatform)')
end
end
It has its appropriate views for both HTML and non HTML versions of said mail. We then do:
UserMailer.registration_confirmation(#user).deliver
in the user create controller to send the mail, but upon submitting the form and creating the user I instantly get:
SocketError (getaddrinfo: nodename nor servname provided, or not known)
So I thought, lets look at the logs (Warning its very long):
UserMailer#registration_confirmation: processed outbound mail in 520.0ms
Sent mail to trolololololololo#mmmmmm.com (89.3ms)
Date: Fri, 04 Jul 2014 19:36:17 -0600
From: AisisPlatForm#AisisPlanner.com
To: trolololololololo <trolololololololo#mmmmmm.com>
Message-ID: <53b7569190dcc_957f3fc5b1ce122c939c1#Adams-Mac-mini.local.mail>
Subject: Welcome to AisisPlatform!
Mime-Version: 1.0
Content-Type: multipart/alternative;
boundary="--==_mimepart_53b756918f0f4_957f3fc5b1ce122c93864";
charset=UTF-8
Content-Transfer-Encoding: 7bit
----==_mimepart_53b756918f0f4_957f3fc5b1ce122c93864
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
trolololololololo,
Welcome and thank you for signing up to AisisPlatform.
We believe that our small, simple and yet very powerful API will allow you to create blog you have always wanted to create.
We are constently growing and evolving the feature set and coming out with new ideas and concepts we hope to share with you.
We are more then grateful for your participation in our services and hope we can be of use to you in any way shape or form that will
help make you happy and excited to use and share our services and products.<
sincerly,
AisisPlatform
----==_mimepart_53b756918f0f4_957f3fc5b1ce122c93864
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
<h3>trolololololololo,</h3>
<p>Welcome and thank you for signing up to AisisPlatform.</p>
<p>We believe that our small, simple and yet very powerful API will allow you to create blog you have always wanted to create.
We are constently growing and evolving the feature set and coming out with new ideas and concepts we hope to share with you.</p>
<p>We are more then grateful for your participation in our services and hope we can be of use to you in any way shape or form that will
help make you happy and excited to use and share our services and products.</p>
<p>sincerly,</p>
<p><em>AisisPlatform</em></p>
----==_mimepart_53b756918f0f4_957f3fc5b1ce122c93864--
Completed 500 Internal Server Error in 1048ms
SocketError (getaddrinfo: nodename nor servname provided, or not known):
/Users/Adam/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/smtp.rb:541:in `initialize'
/Users/Adam/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/smtp.rb:541:in `open'
/Users/Adam/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/smtp.rb:541:in `tcp_socket'
/Users/Adam/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/smtp.rb:551:in `block in do_start'
/Users/Adam/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/timeout.rb:91:in `block in timeout'
/Users/Adam/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/timeout.rb:101:in `call'
/Users/Adam/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/timeout.rb:101:in `timeout'
/Users/Adam/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/smtp.rb:550:in `do_start'
/Users/Adam/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/net/smtp.rb:520:in `start'
mail (2.5.4) lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
mail (2.5.4) lib/mail/message.rb:2129:in `do_delivery'
mail (2.5.4) lib/mail/message.rb:232:in `block in deliver'
actionmailer (4.1.0) lib/action_mailer/base.rb:527:in `block in deliver_mail'
activesupport (4.1.0) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.1.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.1.0) lib/active_support/notifications.rb:159:in `instrument'
actionmailer (4.1.0) lib/action_mailer/base.rb:525:in `deliver_mail'
mail (2.5.4) lib/mail/message.rb:232:in `deliver'
/Users/Adam/.rvm/gems/ruby-2.1.1/bundler/gems/Xaaron-2ee49cf0018e/app/controllers/xaaron/users_controller.rb:20:in `create'
actionpack (4.1.0) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.1.0) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.1.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.1.0) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.1.0) lib/active_support/callbacks.rb:113:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:113:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
activesupport (4.1.0) lib/active_support/callbacks.rb:229:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:229:in `block in halting'
activesupport (4.1.0) lib/active_support/callbacks.rb:229:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:229:in `block in halting'
activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.0) lib/active_support/callbacks.rb:86:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:86:in `run_callbacks'
actionpack (4.1.0) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.1.0) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.1.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.1.0) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.1.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.1.0) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.1.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.1.0) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.1.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/Users/Adam/.rvm/gems/ruby-2.1.1/bundler/gems/promiscuous-9bda9a49ac13/gemfiles/lib/promiscuous/railtie.rb:6:in `process_action'
actionpack (4.1.0) lib/abstract_controller/base.rb:136:in `process'
actionview (4.1.0) lib/action_view/rendering.rb:30:in `process'
actionpack (4.1.0) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.1.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.1.0) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.1.0) lib/action_dispatch/routing/route_set.rb:80:in `call'
actionpack (4.1.0) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.1.0) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.1.0) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.1.0) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.1.0) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.1.0) lib/action_dispatch/routing/route_set.rb:676:in `call'
railties (4.1.0) lib/rails/engine.rb:514:in `call'
railties (4.1.0) lib/rails/railtie.rb:194:in `public_send'
railties (4.1.0) lib/rails/railtie.rb:194:in `method_missing'
actionpack (4.1.0) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.1.0) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.1.0) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.1.0) lib/action_dispatch/routing/route_set.rb:676:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:35:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/flash.rb:254:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.1.0) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.1.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
activerecord (4.1.0) lib/active_record/migration.rb:380:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.1.0) lib/active_support/callbacks.rb:82:in `run_callbacks'
actionpack (4.1.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.1.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.1.0) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.1.0) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.1.0) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.1.0) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.1.0) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.1.0) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/static.rb:64:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.1.0) lib/rails/engine.rb:514:in `call'
railties (4.1.0) lib/rails/application.rb:144:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
/Users/Adam/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/Users/Adam/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/Users/Adam/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
Rendered /Users/Adam/.rvm/gems/ruby-2.1.1/gems/actionpack-4.1.0/lib/action_dispatch/middleware/templates/rescues/_source.erb (0.5ms)
[1m[36mPromiscuous Recovery Delete (23.8ms)[0m [1mDELETE FROM _promiscuous WHERE id = 17[0m
Rendered /Users/Adam/.rvm/gems/ruby-2.1.1/gems/actionpack-4.1.0/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.0ms)
Rendered /Users/Adam/.rvm/gems/ruby-2.1.1/gems/actionpack-4.1.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.0ms)
Rendered /Users/Adam/.rvm/gems/ruby-2.1.1/gems/actionpack-4.1.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (15.3ms)
What is going on? Why am I getting this error? I followed Ryan Bates Setting up mail. Is it out of date?
The error tells you that Ruby is not able to find a DNS entry for the SMTP server.
This is because you have a typo in your configuration, its smtp.gmail.com and not smptp.gmail.com. Furthermore the domain should be your domain, not gmail.com:
ActionMailer::Base.smtp_settings = {
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'aisisplanner.com',
:user_name => Figaro.env.EMAIL,
:password => Figaro.env.PASSWORD,
:authentication => 'plain',
:enable_starttls_auto => true
}
see: http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration-for-gmail