Message from discussion why revert "adding accessible option to allow for allowing mass assignments"?
Received: by 10.100.231.16 with SMTP id d16mr23387anh.20.1221515015887; Mon,
15 Sep 2008 14:43:35 -0700 (PDT)
Date: Mon, 15 Sep 2008 14:43:35 -0700 (PDT)
X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; en-us)
AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1,gzip(gfe),gzip(gfe)
Subject: Re: why revert "adding accessible option to allow for allowing mass
From: Ryan Bates <r...@railscasts.com>
To: "Ruby on Rails: Core" <email@example.com>
Content-Type: text/plain; charset=ISO-8859-1
I've been giving some thought to the interface. One question I keep
coming back to is: how much do we want to support multi-model forms
through this? I think that is the primary use case, but this has other
uses as well. Active Record is not specific to web interfaces and
therefore shouldn't be tied too heavily to them.
IMO Approach 1 (at http://gist.github.com/10793) is the cleanest
approach if we're just doing this all in Ruby. This is also fairly
easy to use in a web form. However, there are a few major drawbacks
when doing so:
1. The resulting HTML is not validatable due to the duplicate form
of the duplicate form field names.
3. It's impossible to nest associations multiple layers deep because
it gets confused when there are multiple "" in the field name.
4. Checkboxes (and I think radio buttons?) are nearly impossible to
Each of these problems stem from the fact that not each field has a
unique name/identifier. Therefore when it comes to multi-model form
fields, I'm more inclined to go with Approach 3 because each record
has its own unique key/identifier. Theoretically that will solve all
of the problems above.
That said, if you ever need to set associated attributes in other
scenarios (maybe preparing data in test cases), then Approach 3 is not