Fork me on GitHub

Use STI and polymorphic model for multiple uploads

18 Aug 2010

Richard Huang

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. Read More

Tags 


to_s/to_s(:short)

16 Aug 2010

Yincan

override the to_s to make the method sensible instead of "display_name", "format_name".. Read More

Tags 


Use css sprite automatically

15 Aug 2010

Richard Huang

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. Read More

Tags 


Use I18n.localize for date/time formating

06 Aug 2010

Ng Tze Yang

For reliable formatting of a date/time string in the desired language, use I18n.localise, Time#strftime can cause u unnecessary headache. Read More

Tags 


Use multipart/alternative as content_type of email

05 Aug 2010

Richard Huang

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. Read More

Tags 


Use asset_host for production server

31 Jul 2010

Richard Huang

Use asset host for cookie-free domains for components, that make your components load faster. Read More

Tags 


Use render :collection Rails when possible

29 Jul 2010

Helmut Juskewycz

Tags 


DRY your database.yml

28 Jul 2010

Eric Anderson

Use YAML's anchor and reference syntax to DRY up your database.yml file. Read More

Tags 


Use nested step to improve readability of ur scenario

27 Jul 2010

Ng Tze Yang

When a scenario has too many steps, it becomes hard to read & follow. Using nested step helps to clean up the scenario, & helps promote reusability of groups of steps, think of it as code refactoring. Read More

Tags 


Use 'Background' to consolidate common steps in a feature

27 Jul 2010

Ng Tze Yang

Very often, we tend to repeat a number of common steps in all scenarios within a feature, to dry things up, as well as improve readability (helping reader to better focus the intent of each scenario), we can use 'Background'. Read More

Tags