After reading previous discussions on the topic ([1] and [2]), I have
tried to take the best ideas and create a working plugin that adds
nested mass assignment to ActiveRecord. Please see
http://github.com/cainlevy/nested_assignment/tree/master.

My paradigm parameters are:

  {
    # singular associations
    :avatar_params => {
      :id => '7',
      :name => 'mugshot.jpg'
    },

    # plural associations
    :tasks_params =>
      {
        # create
        '1' => { :name => "Baz" },
        # update
        '2' => { :id => '3', :name => "Foo" },
        # destroy
        '3' => { :id => '5', :name => "Bar", :_delete => '1'}
      }
  }

Ryan, I don't believe this is on http://gist.github.com/10793.

There is one failing test for this setup because of a limitation with
using #build for a has_one association (which I've started a separate
discussion about[3]). The plugin's tests are in sqlite3 :memory:, so
they should be pretty easy to set up and run.

So the question is: what's missing? How could this be improved?

-Lance

[1]http://groups.google.com/group/rubyonrails-core/browse_thread/
thread/4049b4b313fa8be2
[2]http://groups.google.com/group/rubyonrails-core/browse_thread/
thread/3c61e00916c365e5/f0a19fc01d0246fc
[3]http://groups.google.com/group/rubyonrails-core/browse_thread/
thread/18cf8b059f5ded4a
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to