Tag view

3 votes

6786 views

model.collection_model_ids (many-to-many)

When you want to associate a model to many association models by checkbox on view, you should take advantage of model.collection_model_ids to reduce the code in controller.

Comments

by ihower
ihower

6 votes

14291 views

Nested Model Forms

Use accepts_nested_attributes_for to make nested model forms much easier, this feature is provided by rails 2.3

Comments

by ihower
ihower

10 votes

8231 views

Move code into controller

According to MVC architecture, there should not be logic codes in view, in this practice, I will introduce you to move codes into controller.

implemented

Comments

by ihower
ihower

10 votes

9397 views

Move code into model

According to MVC architecture, there should not be logic codes in view, in this practice, I will introduce you to move codes into model.

implemented

Comments

by ihower
ihower

11 votes

8941 views

Move code into helper

According to MVC architecture, there should not be logic codes in view, in this practice, I will introduce you to move codes into helper.

implemented

Comments

by ihower
ihower

25 votes

32200 views

Replace instance variable with local variable

In partial view, we can use the instance variable directly, but it may be confused and make it hard to reuse anywhere, because we don't know exactly which instance variable can be used, so use the local variable in partial with explicitly assignment.

implemented

Comments

by ihower
ihower

5 votes

17271 views

hjuskewycz

6 votes

11772 views

abuse content_for

Use content_for for grouping html contents like javascript and css

Comments

by jvnill
jvnill

11 votes

6274 views

use OpenStruct when advance search

use OpenStruct when advance search

Comments

alvin2ye

9 votes

13086 views

Put scripts at the bottom

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.

Comments

flyerhzm