Home
Ruby namespace tips
After made below test, then you don’t need to use Test::B.bbb
in everywhere of your plugin, just use B.bbb
.
27 Apr 2012
Found a way to be more productive
Personally, I like to focus on doing one thing and make it perfect, so as soon as I been engaged to one thing, I will spend all my time and consentration on it.
Then How to engage one project as soon as possible?
- Stop doing other projects, or phase out doing them.
- To know more things related to this project.
- Clarify the aim and things you need to do, seems like couple of days job could finish them. (that’s why we need a sprint, if it’s too long, it’s frustring.)
- Make the first success ;)
27 Apr 2012
ActiveSupport autoload_at
What does below code means?
Pretty simple, it will load all Modules in that block in action_view/template/resolver.rb
file.
27 Apr 2012
How to send Multipart email in Rails.
Yes, it sounds pretty easy, just write code like below:
This code will generate a multipart email, that put the html content as the first part, and text content as second part. This will cause a problem is, when you open the email in mailbox, Oh, 奶奶的, why it’s text version. You must expect “It should show html when mail client support MIME, and show text version if it’s not support MIME.”
Actually, the truth is:
Before the first boundary is an area that is ignored by MIME-compliant clients. This area is generally used to put a message to users of old non-MIME clients.
25 Apr 2012
RVM install REE got error on Lion
Today I install json gem, got a an error, then googled a little bit found I need to reinstall my ruby in RVM, then I updated rvm and reinstalled ruby 1.9.3, but got problem when install REE, got following errors:
After I installed the osx-gcc-installer
Then things solved.
Since Lion is using LLVM-gcc instead of gcc, so it can’t compile REE.
14 Apr 2012