remember to require mysql gem first require "rubygems"
with MySQL 5.1 db = Mysql.init
db.real_connect("localhost", "username", "password", "database")
with MySQL 5.5 db = Mysql.real_connect("localhost", "username", "password", "database")
db.charset = "utf8"
check the result: puts db.character_set_name
If you got utf8, Congratulations!
Recently, I am working on sending email in my rails project. I use AWS SES (Amazon Web Services - Simple Email Service). But except some specific settings, others usage should be the same.
And I follow the official user guide: ...
I don't know what's going on. But it just doesn't work.
The work one: UserMailer.welcome_email(@user.name, @user.email)
Passing all parameters you're going to use, in Primitive type. (eg. String, Integer, Boolean)
If you use Objects (including Models). It cannot get your attributes. And Email headers (From, to, Subject) may stay blank. Than encounter this error:
Completed 500 Internal Server Error in 1392ms
AWS::SES::ResponseError (InvalidParameterValue - Missing required header 'To'.):
The reason is that ActionMailer is Observer. It creates a new process to run on. But objects can't be accessed in difference process. So you should only …