I’m fed up with doing a bunch of complex model aggregation in my controllers. They are too bloated. Here’s a set of links I’m trying to make sense of as I decide what to do:
- http://validatable.rubyforge.org/
- http://pastie.textmate.org/pastes/134685
- http://blog.jayfields.com/2007/02/ruby-forwardable-addition.html
- http://www.brynary.com/2007/4/8/fluent-interface-for-ruby-delegation
- http://weblog.jamisbuck.org/2007/1/11/moving-associated-creations-to-the-model
- http://groups.google.com/group/rubyonrails-core/browse_thread/thread/3c61e00916c365e5?pli=1
- http://ryandaigle.com/articles/2008/7/19/what-s-new-in-edge-rails-nested-models
Seems like if you can avoid building an extra Presenter model and keep everything in your Rails models you’re better off, though the situation if complex enough, may dictate breaking such stuff out.
Handy in either scenario is Jay Fields validatable plugin for giving you better control over validations on collections of model objects.
The mass assignment stuff that was in edge but has been removed (dammit) may well have been perfect for my needs. As long as my form builders can produce posted parameters as nested hashes that match the model hierarchy I wouldn’t have to do anything by ParentModel.create(params[:parent_model]) and everything is taken care of for me.




Discussion
No comments for “Complex forms, mass assignment, and the “presenter””