class Notifier < ActionMailer::Base def signup_notification(recipient) recipients recipient.email_address_with_name bcc ["[email protected]"] from "[email protected]" subject "New account information" body :account => recipient end end
Actually, yesterday we were getting “uninitialized constant ActionMailer::Quoting::Encoding” while using ActionMailer in production but it was working fine in all modes(development/production) on localhost. Our mailer was like:
class Notifier < ActionMailer::Base def signup_notification(recipient) @recipients = recipient.email_address_with_name @bcc = ["[email protected]"] @from = "[email protected]" @subject = "New account information" @body = :account => recipient end end
We could not find the actual issue with this mailer. But the above said error was disappeared when we changed the same mailer as following:
class Notifier < ActionMailer::Base def signup_notification(recipient) recipients recipient.email_address_with_name bcc ["[email protected]"] from "[email protected]" subject "New account information" body :account => recipient end end
Do you guys have any idea? I would love to listen from you.
Update: No its not solved yet. Still same issue. May be some issue with character encoding with the TMail object.
Update 2: This was the issue http://github.com/hmcgowan/roo/issues#issue/4/comment/106328
]]>Anybody tried it already?
]]>Fortunately, two days ago I found something which resolved this issue. It is a linux command and print a particular image on four pages. Here is that command:
lp -o scaling=200 models.png
]]>You are all set now, go deploy you rails app. I have tested it on linode(ubuntu8.10), slicehost(ubuntu 8.10), should work for you too
]]>Now you can do something like User.each and User.find_in_batches.
Please refer here for more details.
]]>Sometimes I wonder why my custom rake task doesn’t appear in rake -T list, however it runs well. I just noticed that if I do not specify description for a task then that particular rake task does not appear in the task list.
]]>If you guys want to open your app’s DB shell. Then you can use rails utility ‘dbconsole’ by issuing “script/dbconsole” from rails root directory.
It will ask for DB password, and open your db shell.
If you use sake, you may like following sake task:
desc ‘Launches the database shell using the values defined in config/database.yml’
task ‘db:shell’, :needs => [ ‘environment’ ] do
config = ActiveRecord::Base.configurations[(RAILS_ENV or “development”)]
command = “”
case config[“adapter”]
when “mysql” then
(command << "mysql ")
(command << "--host=#{(config["host"] or "localhost")} ")
(command << "--port=#{(config["port"] or 3306)} ")
(command << "--user=#{(config["username"] or "root")} ")
(command << "--password=#{(config["password"] or "")} ")
(command << config["database"])
when "postgresql" then
puts("You should consider switching to MySQL or get off your butt and submit a patch")
else
(command << "echo Unsupported database adapter: #{config["adapter"]}")
end
system(command)
end
[/ruby]
OpenSSL::SSL::SSLError (hostname was not match with the server certificate): /usr/lib/ruby/1.8/openssl/ssl.rb:123:in `post_connection_check' /usr/lib/ruby/1.8/net/smtp.rb:582:in `tlsconnect' /usr/lib/ruby/1.8/net/smtp.rb:562:in `do_start' /usr/lib/ruby/1.8/net/smtp.rb:525:in `start' /vendor/rails/actionmailer/lib/action_mailer/base.rb:671:in `perform_delivery_smtp' /vendor/rails/actionmailer/lib/action_mailer/base.rb:526:in `__send__' /vendor/rails/actionmailer/lib/action_mailer/base.rb:526:in `deliver!' /vendor/rails/actionmailer/lib/action_mailer/base.rb:392:in `method_missing' /app/controllers/users_controller.rb:40:in `send_email_to_confirm_user'
If you use postfix, then you fix it quickly by disabling tls by setting “smtpd_use_tls=no” in /etc/postfix/main.cf .
Remember to restart postfix and rails app server.
]]>