// you’re reading...

All

Complex forms, mass assignment, and the “presenter”

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:

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””

Post a comment

You must be logged in to post a comment.

Recent @ShellyShelly Tweets

  • Thanks @barackobama for coming out in support of gay marriage. 1 week ago
  • Thanks @noahi for talking at Dorkbot about Data visualizations! Use position for ordered data. Got it. 2 weeks ago
  • At #dorkbotsea cool stuff simon winder talking about Using old tech eg vacuum tubes in his art 2 weeks ago
  • I am so grateful my brother finally has a place with his own room and is getting the care/medication he needs. Thanks DESC 2 weeks ago
  • Super fun today making giant human scale bird cage today with metal work buddies 3 weeks ago