rails devise logger log level - ruby-on-rails

I am using devise 2.0.4 in my rails 3.2 application. I am using the built in devise action mailer to send welcome and password reset emails. One thing I noticed is that devise does not log the email headers to the log file in production environment but does it in the development environment, in production it just logs a line "Sent mail to XXXXXX". I am trying to figure out two things:
How do I give devise my own logger with a log level set?
Is there a way to change the log level that is set in devise, it looks like it is set to INFO now, so can I set it to debug.
Thank you

Related

Ruby on Rails Devise - Setup - Already Used?

Working through the setup for Devise.
Running
rails generate devise admin
since admin seems to be the user model setup in my app where I now what it to be SSO auth but I get
The name 'Admin' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative or use --skip-collision-check or --force to skip this check and run this generator again.
is it OK to force/ignore this? or ?

Devise use different email template in production and development

I customized devise email templates under
views/devise/mailer/ and everything worked fine in development mode.
When I switched to production mode, devise sends email with the default email templates instead of the ones I customized.
Anything that might cause this?
Thanks!
I solved this by restarting my sidekiq. Apparently sidekiq had a cache of the original email template.

Devise in rails giving error on heroku

I am using devise with mongoid. App has two devise models users and investors. When I sign-up for each in localhost it works fine but on heroku when I submit form the page get redirects to app/users or app/investors and I got 500 service internal error. In the app the views directory of users and investors are separately defined.
Any guesses?
Finally solved the issue was the mongodb service, they actually reset the password, so I have to change that in mongoid.yml. My advice for people working with service:
1) Start your debugging with config files the username and password before jumping to plugin code. I spend 5 hours in debugging devise internal code and problem was somewhere else.

What is the best way to test Action mailer without worrying about the enviroment-rails 3

i need to test the action mailer in my ruby on rails project which is already live.i don't want to go in the mess of creating a new mail server like zimbra on localhost or mess with the configurations of the other environments that i have.moreover i cant think of looking in the log files which will be a complete height of patience.is there any other way to check/debug action mailer in localhost.if yes then how and if not then why not?
Several alternatives:
define an interceptor in development, see this railscast
use letter_opener gem to see the mail instead of actually sending it, link to gem

How do I send signed emails from ActionMailer in Rails 3?

Using Rails 3 I want to use an X.509 certificate to sign parts of emails. There is a currently existing answer for Rails 2 at How do I send signed emails from ActionMailer? but it doesn't work on Rails 3.
Is it possible to sign emails via ActionMailer in Rails 3?
If that is not possible, is it possible to sign emails via sendmail after creating by ActionMailer?
perhaps it's not the best answer, however here's what I'd do:
try to install that plugin (even if it's for rails 2.0.x)
tests and fix code until I get the result
looking at the code, turns out that the core file is:
https://github.com/penso/actionmailer_x509/blob/master/lib/actionmailer_x509.rb
which exposes a bunch of methods for mailer DSL:
x509_sign true # or false
x509_cert "path/to/cert"
x509_key "path/to/key"
x509_passphrase "passphrase"
so you could grab that file, and put it under $APP/lib, then write some test to check it's working.
A.
I have been ported actionmailer_x509 to Rails 3 and wrap it into the gem. So now it works and available here: https://github.com/petRUShka/actionmailer_x509

Resources