Posts Tagged ‘best-practices’
“new” actions in nested rails resources
October 28th, 2007 •
tags: best-practices, rails
def new @my_model = MyModel.new end # vs. def new @my_model = @my_parent_model.my_models.build # gives you access to parent properties # (useful e.g. in views) end
CUDdly design (as coined by Pivotal Labs)
October 16th, 2007 •
tags: best-practices, rails, rails models
Pivotal Labs coin the term CUDdly Models for refactoring public model actions with side effects, into proper ActiveRecord callbacks, thus leveraging the power of encapsulation, transactions, consistent interface, and (activerecord) lifecycle power.
See this for a more thorough explanation.
beautiful code (Marcel Molina at rubyhoedown2007)
October 15th, 2007 •
tags: best-practices
Apply these principles to software development not because they necessarily define beauty, but they definitely define something good!
- PROPORTION
- INTEGRITY
- CLARITY