Rails Best Practices
|
5 votes 0 comments 1733 views |
There are a few posts told you how to integrate bundler into capistrano, but they are out of date now. After bundler 1.0 released, you can add only one line in capistrano to use bundler. |
by flyerhzm | |
|
4 votes 0 comments 965 views |
Do you experience that your website renders slow due to loading a lot of javascripts, especially loading some third-party javascripts? Move script tags to the bottom of body can speed up the render of your website. |
by flyerhzm | |
|
4 votes 0 comments 535 views |
use OpenStruct when advance search use OpenStruct when advance search |
by alvin2ye | |
|
2 votes 12 comments 2513 views |
I don't remember how many times I need to fetch current user in models, such as audit log. Here is a flexible way to set the current user in and fetch the current user from User model. |
by flyerhzm | |
|
7 votes 1 comments 585 views |
Use say and say_with_time in migrations to make a useful migration log Use say_with_time and say in migrations will produce a more readable output in migrations. And if use correctly it could be a helpful friend when something goes wrong because normally it is stored in the deploy log |
by Guillermo | |
|
1 votes 12 comments 1599 views |
Use STI and polymorphic model for multiple uploads This is a flexible and reusable solution for multiple uploads, using STI model to save all the uploaded assets in one "assets" table and using polymorphic model to reuse "Asset" model in different uploadable models. |
by flyerhzm | |
|
2 votes 5 comments 597 views |
override the to_s to make the method sensible instead of "display_name", "format_name".. |
by yincan | |
|
2 votes 0 comments 874 views |
Using css sprite can reduce a large number of http requests, so it makes the web page loaded much faster. It it painful to composite a lot of images manually, do it automatically. |
by flyerhzm | |
|
1 votes 3 comments 595 views |
Use I18n.localize for date/time formating For reliable formatting of a date/time string in the desired language, use I18n.localise, Time#strftime can cause u unnecessary headache. |
by ngty | |
|
3 votes 1 comments 860 views |
Use multipart/alternative as content_type of email Rails uses plain/text as the default content_type for sending email, you should change it to multipart/alternative that email clients can display html formatted email if they support and display plain text email if they don't support html format. |
by flyerhzm |
