Tag view
3 votes
0 comments
2500 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.
6 votes
2 comments
4526 views
Use accepts_nested_attributes_for to make nested model forms much easier, this feature is provided by rails 2.3
10 votes
0 comments
3482 views
According to MVC architecture, there should not be logic codes in view, in this practice, I will introduce you to move codes into controller.
implemented10 votes
8 comments
4035 views
According to MVC architecture, there should not be logic codes in view, in this practice, I will introduce you to move codes into model.
implemented9 votes
2 comments
3891 views
According to MVC architecture, there should not be logic codes in view, in this practice, I will introduce you to move codes into helper.
implemented19 votes
9 comments
9282 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.
implemented5 votes
2 comments
4416 views
Use content_for for grouping html contents like javascript and css
8 votes
1 comments
5551 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.
