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
Related
I have two devise models- Student and Teacher. All of my Rspec tests are passing, which must go through the sign up/sign in process. The thing is, the exact same code works on a friend's computer, however, when I run the rails server on my machine, and try to access the teacher sign in form by going to http://localhost:3000/teachers/sign_in, I get this stack trace in my terminal:
ArgumentError in Devise::SessionsController#new
wrong number of arguments (2 for 1)
Here is my full stack trace from the terminal:
Started GET "/teachers/sign_in" for ::1 at 2016-04-09 13:39:11 +0100
Processing by Devise::SessionsController#new as HTML
Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms)
ArgumentError (wrong number of arguments (2 for 1)):
devise (3.5.6) lib/devise.rb:464:in `[]'
devise (3.5.6) lib/devise.rb:464:in `block (2 levels) in configure_warden!'
warden (1.2.6) lib/warden/session_serializer.rb:34:in `fetch'
warden (1.2.6) lib/warden/proxy.rb:212:in `user'
warden (1.2.6) lib/warden/proxy.rb:322:in `_perform_authentication'
warden (1.2.6) lib/warden/proxy.rb:104:in `authenticate'
warden (1.2.6) lib/warden/proxy.rb:114:in `authenticate?'
devise (3.5.6) app/controllers/devise_controller.rb:103:in `require_no_authentication'
activesupport (4.2.5) lib/active_support/callbacks.rb:432:in `block in make_lambda'
activesupport (4.2.5) lib/active_support/callbacks.rb:145:in `call'
activesupport (4.2.5) lib/active_support/callbacks.rb:145:in `block in halting_and_conditional'
activesupport (4.2.5) lib/active_support/callbacks.rb:504:in `call'
activesupport (4.2.5) lib/active_support/callbacks.rb:504:in `block in call'
activesupport (4.2.5) lib/active_support/callbacks.rb:504:in `each'
activesupport (4.2.5) lib/active_support/callbacks.rb:504:in `call'
activesupport (4.2.5) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
activesupport (4.2.5) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
activesupport (4.2.5) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.5) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.5) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.5) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.5) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.5) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.5) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.5) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.5) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.5) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.5) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.5) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.5) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:76:in `call'
actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:76:in `dispatch'
actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:45:in `serve'
actionpack (4.2.5) lib/action_dispatch/routing/mapper.rb:49:in `serve'
actionpack (4.2.5) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.5) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.5) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:817: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 `catch'
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:25:in `call'
rack (1.6.4) lib/rack/head.rb:13:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.5) 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.5) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.5) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.5) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
activerecord (4.2.5) lib/active_record/migration.rb:377:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.5) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.5) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.5) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.5) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.5) 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 `catch'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.5) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.5) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.5) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.5) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.5) 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.5) 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.5) lib/action_dispatch/middleware/static.rb:116:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.5) lib/rails/engine.rb:518:in `call'
railties (4.2.5) 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/charlieperson/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
/Users/charlieperson/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
/Users/charlieperson/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
Rendered /Users/charlieperson/.rvm/gems/ruby-2.2.3/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_source.erb (3.8ms)
Rendered /Users/charlieperson/.rvm/gems/ruby-2.2.3/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.7ms)
Rendered /Users/charlieperson/.rvm/gems/ruby-2.2.3/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.8ms)
Rendered /Users/charlieperson/.rvm/gems/ruby-2.2.3/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (45.7ms)
Rendered /Users/charlieperson/.rvm/gems/ruby-2.2.3/gems/web-console-2.3.0/lib/web_console/templates/_markup.html.erb (0.6ms)
Rendered /Users/charlieperson/.rvm/gems/ruby-2.2.3/gems/web-console-2.3.0/lib/web_console/templates/_inner_console_markup.html.erb within layouts/inlined_string (0.2ms)
Rendered /Users/charlieperson/.rvm/gems/ruby-2.2.3/gems/web-console-2.3.0/lib/web_console/templates/_prompt_box_markup.html.erb within layouts/inlined_string (0.3ms)
Rendered /Users/charlieperson/.rvm/gems/ruby-2.2.3/gems/web-console-2.3.0/lib/web_console/templates/style.css.erb within layouts/inlined_string (0.3ms)
Rendered /Users/charlieperson/.rvm/gems/ruby-2.2.3/gems/web-console-2.3.0/lib/web_console/templates/console.js.erb within layouts/javascript (40.8ms)
Rendered /Users/charlieperson/.rvm/gems/ruby-2.2.3/gems/web-console-2.3.0/lib/web_console/templates/main.js.erb within layouts/javascript (0.2ms)
Rendered /Users/charlieperson/.rvm/gems/ruby-2.2.3/gems/web-console-2.3.0/lib/web_console/templates/error_page.js.erb within layouts/javascript (0.3ms)
Rendered /Users/charlieperson/.rvm/gems/ruby-2.2.3/gems/web-console-2.3.0/lib/web_console/templates/index.html.erb (90.3ms)
The devise sign up/sign in form does show up correctly when I go to http://localhost:3000/students/sign_in but once I click log in I get this error:
ArgumentError in DashboardController#index
wrong number of arguments (2 for 1)
def index
#student = current_student
#teacher = current_teacher (It doesn't like this line)
end
Essentially, it refuses to recognize or let me use the devise helper methods. Any help would be greatly appreciated. If this is not clear enough, please let me know. I searched for an answer for a very long time, tried many proposed solutions, without any luck.
It's caused by this line inside the devise gem, which suggests that key is not what devise expects it to be, perhaps there's something in your session that devise is choking on.
Try resetting your session (have your friend do the same on his computer) by deleting your browser cookies for your site.
I am having a devise user model.
To login I am using twitter-bootstrap modal.The modal is by default hidden and shown only after an rails default ajax request is send to the server.
It works fine with localhost and production. But when a user is on a subdomain(using acts_as_tenant) like business.lvh.me:3000 the modal window does not pop up and the ajax request fails.
I am sharing the session across all the domains.
My SessionStore initializer.
> Rails.application.config.session_store :active_record_store, :key =>
> '_my_app_session',domain: 'lvh.me'
PFB the error.log for the same.
Rendered remote_content/_remote_sign_up.html.erb (78.8ms)
Rendered remote_content/remote_sign_up.js.erb (86.2ms)
Security warning: an embedded <script> tag on another site requested protected JavaScript. If you know what you're doing, go ahead and disable forgery protection on this action to permit cross-origin JavaScript embedding.
Completed 422 Unprocessable Entity in 100ms (Views: 96.1ms | ActiveRecord: 1.6ms)
ActionController::InvalidCrossOriginRequest - Security warning: an embedded <script> tag on another site requested protected JavaScript. If you know what you're doing, go ahead and disable forgery protection on this action to permit cross-origin JavaScript embedding.:
actionpack (4.2.4) lib/action_controller/metal/request_forgery_protection.rb:225:in `verify_same_origin_request'
activesupport (4.2.4) lib/active_support/callbacks.rb:432:in `block in make_lambda'
activesupport (4.2.4) lib/active_support/callbacks.rb:239:in `block in halting'
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 `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'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
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: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'
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'
request_store (1.2.0) lib/request_store/middleware.rb:8: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.9.2) lib/puma/server.rb:490:in `handle_request'
puma (2.9.2) lib/puma/server.rb:361:in `process_client'
puma (2.9.2) lib/puma/server.rb:254:in `block in run'
puma (2.9.2) lib/puma/thread_pool.rb:92:in `block in spawn_thread'
You've hit a problem with CORS (Cross Origin Request Source).
This is a standard specification designed to prevent malicious XML requests through JS -- simply, it means you cannot send uninvited XML requests to other servers; they have to be permitted through that server's CORS policy.
Rack CORS
The important thing for you to note is that the CORS spec extends to subdomains (it treats a subdomain as completely different to a domain).
This means you have to explicitly permit your subdomains in your CORS policy on the server. You can either do this through your web server (EG NGinx or Apache), or through the Rack Middleware stack.
For Rails, there is a very very very very good gem which handles CORS, called Rack-CORS...
#Gemfile
gem "rack-cors"
#config/application.rb
module YourApp
class Application < Rails::Application
# ...
config.middleware.insert_before 0, "Rack::Cors" do
allow do
origins '*'
resource '/*',
:headers => :any,
:methods => [:get, :post, :options],
:if => proc { |env| env['HTTP_HOST'] == 'api.example.com' }
end
end
end
end
--
Because you're sending an AJAX request across your subdomains, your server is treating that as if two completely separate domains are trying to access each other with Ajax.
Of course, we know this is not the case, but CORS doesn't.
Thus, if you want to fix it, you should apply the code above, with your own subdomain for HTTP_HOST.
I fixed the issue by using
<%= link_to "login", remote_login_url, :remote => true%>
instead of
<%= link_to('login', remote_login_url(:subdomain => 'www')),:remote => true %>
And changing the default after sign up and sign in paths for devise registrations and sessions controller.
And as suggested by Rich using Rack-CORS would be helpful in these situations while dealing with ajax and subdomains.
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.
I tried to follow the 'Secure Upload' in carrier wave which is a bit confusing because I have customized the file path and all a bit. When I try to run the app, I get 'Cannot read file' error.
Here's the route :
match "/uploads/tobereviewed/:user.:username.downcase/:basename.:extension", :controller => "photos", :action => "uploaded", via: :get
The sotre_dir of uploader :
class SubmitUploader < CarrierWave::Uploader::Base
def store_dir
"uploads/tobereviewed/#{model.user.username.downcase}"
end
carrierwave.rb initializer :
CarrierWave.configure do |config|
config.permissions = 0600
config.directory_permissions = 0700
config.root = Rails.root
end
Photos controller :
def uploaded
file = Submit.first
send_file "#{Rails.root}/uploads/tobereviewed/#{file.user.username.downcase}/#{file.id}"
end
The full error log :
Started GET "/uploaded" for 127.0.0.1 at 2014-11-27 18:19:09 +0530
Processing by PhotosController#uploaded as HTML
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]]
Submit Load (2.6ms) SELECT "submits".* FROM "submits" ORDER BY "submits"."id" ASC LIMIT 1
User Load (2.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 1]]
Sent file /home/pubudu/Projects/istockseller/uploads/tobereviewed/thpubs/36603935 (0.7ms)
Completed 500 Internal Server Error in 54ms
ActionController::MissingFile - Cannot read file /home/pubudu/Projects/istockseller/uploads/tobereviewed/thpubs/36603935:
actionpack (4.2.0.beta4) lib/action_controller/metal/data_streaming.rb:68:in `send_file'
actionpack (4.2.0.beta4) lib/action_controller/metal/instrumentation.rb:49:in `block in send_file'
activesupport (4.2.0.beta4) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.0.beta4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.0.beta4) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.0.beta4) lib/action_controller/metal/instrumentation.rb:47:in `send_file'
() home/pubudu/Projects/istockseller/app/controllers/photos_controller.rb:24:in `uploaded'
actionpack (4.2.0.beta4) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.2.0.beta4) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.0.beta4) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.0.beta4) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.0.beta4) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.0.beta4) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0.beta4) lib/active_support/callbacks.rb:151:in `block in halting_and_conditional'
activesupport (4.2.0.beta4) lib/active_support/callbacks.rb:234:in `block in halting'
activesupport (4.2.0.beta4) lib/active_support/callbacks.rb:234:in `block in halting'
activesupport (4.2.0.beta4) lib/active_support/callbacks.rb:169:in `block in halting'
activesupport (4.2.0.beta4) lib/active_support/callbacks.rb:92:in `_run_callbacks'
activesupport (4.2.0.beta4) lib/active_support/callbacks.rb:734:in `_run_process_action_callbacks'
activesupport (4.2.0.beta4) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.0.beta4) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.0.beta4) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.0.beta4) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.2.0.beta4) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.0.beta4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.0.beta4) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.0.beta4) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.0.beta4) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.0.beta4) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.0.beta4) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.0.beta4) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.0.beta4) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.2.0.beta4) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.0.beta4) lib/action_controller/metal.rb:236:in `block in action'
actionpack (4.2.0.beta4) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (4.2.0.beta4) lib/action_dispatch/routing/route_set.rb:42:in `serve'
actionpack (4.2.0.beta4) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.0.beta4) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.0.beta4) lib/action_dispatch/routing/route_set.rb:780:in `call'
omniauth (1.2.2) lib/omniauth/strategy.rb:186:in `call!'
omniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.2.2) lib/omniauth/strategy.rb:186:in `call!'
omniauth (1.2.2) lib/omniauth/strategy.rb:164: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 `call'
rack (1.6.0.beta) lib/rack/etag.rb:23:in `call'
rack (1.6.0.beta) lib/rack/conditionalget.rb:25:in `call'
rack (1.6.0.beta) lib/rack/head.rb:13:in `call'
actionpack (4.2.0.beta4) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.0.beta4) lib/action_dispatch/middleware/flash.rb:257:in `call'
rack (1.6.0.beta) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.0.beta) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.0.beta4) lib/action_dispatch/middleware/cookies.rb:558:in `call'
activerecord (4.2.0.beta4) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.0.beta4) lib/active_record/connection_adapters/abstract/connection_pool.rb:647:in `call'
activerecord (4.2.0.beta4) lib/active_record/migration.rb:378:in `call'
actionpack (4.2.0.beta4) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.0.beta4) lib/active_support/callbacks.rb:88:in `_run_callbacks'
activesupport (4.2.0.beta4) lib/active_support/callbacks.rb:734:in `_run_call_callbacks'
activesupport (4.2.0.beta4) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.0.beta4) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.0.beta4) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.0.beta4) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
better_errors (1.1.0) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (1.1.0) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (1.1.0) lib/better_errors/middleware.rb:56:in `call'
web-console (2.0.0.beta4) lib/action_dispatch/debug_exceptions.rb:18:in `middleware_call'
web-console (2.0.0.beta4) lib/action_dispatch/debug_exceptions.rb:13:in `call'
actionpack (4.2.0.beta4) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.0.beta4) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.0.beta4) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.0.beta4) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.0.beta4) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.0.beta4) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.0.beta4) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.0.beta4) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.0.beta) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.0.beta) lib/rack/runtime.rb:17:in `call'
activesupport (4.2.0.beta4) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.0.beta) lib/rack/lock.rb:17:in `call'
actionpack (4.2.0.beta4) lib/action_dispatch/middleware/static.rb:113:in `call'
rack (1.6.0.beta) lib/rack/sendfile.rb:113:in `call'
railties (4.2.0.beta4) lib/rails/engine.rb:514:in `call'
railties (4.2.0.beta4) lib/rails/application.rb:161:in `call'
rack (1.6.0.beta) lib/rack/tempfile_reaper.rb:15:in `call'
rack (1.6.0.beta) lib/rack/lint.rb:49:in `_call'
rack (1.6.0.beta) lib/rack/lint.rb:37:in `call'
rack (1.6.0.beta) lib/rack/showexceptions.rb:24:in `call'
rack (1.6.0.beta) lib/rack/commonlogger.rb:33:in `call'
rack (1.6.0.beta) lib/rack/chunked.rb:54:in `call'
rack (1.6.0.beta) lib/rack/content_length.rb:15:in `call'
rack (1.6.0.beta) lib/rack/handler/webrick.rb:89:in `service'
() home/pubudu/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
() home/pubudu/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
() home/pubudu/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
127.0.0.1 - - [27/Nov/2014:18:19:09 +0530] "GET /uploaded HTTP/1.1" 500 - 0.0743
Update :
I set the correct file path like this :
send_file "#{file.filename.file}"
But then it gives this error :
Cannot read file #<CarrierWave::SanitizedFile:0x007f570c2b9e58>
Is my routes correct?
As per your setup CarrierWave should save your file inside "/home/pubudu/Projects/istockseller/public/uploads/tobereviewed/thpubs/#{model.user.username.downcase}/somefile.ext"
So, ideally your code should be
send_file "#{Rails.root}/public/#{file.image.url}"
Assuming your upload column is image.
Setup debugger in the controller's action.
def uploaded
file = Submit.first
debugger
send_file "#{file.filename.file}"
end
Now, request the action again and go to the debugger console. A tip here is to open "irb" inside the debugger. Just type "irb" and hit enter.
See what file.filename.file is returning. I believe it's an invalid path, so check if the file exists in your filesystem. Then, you can reproduce the next step (send_file) and check the error log.
I'd then advise you to open the source code of CarrierWave gem in your computer and find what's wrong with your code.
In your terminal, go to your project directory and run:
bundle show carrierwave
This will print you the path of the carrierwave gem's source you are using. Open it in your editor and find what's wrong with your code, according to the error log!
Tip
If you provide the current error log (after your update), we may help you better.
Cannot read file #<CarrierWave::SanitizedFile:0x007f570c2b9e58>
is not enough. The full backtrace would be better than this "one line" of code (use pastebin whenever possible).
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