*bump*

Can we get some input on this from Rails core? 

We've discussed this over at rails-i18n a bit more and our thinking is that 
probably nobody wants to delay Rails 3 beta because of this issue. 

So our current thinking is that we want to 

A - provide a good-old monkey-patching plugin. This would give us the 
opportunity to implement a clean-slate solution that does what we believe is 
right. We could get it battletested in plugin-land and put it out for 
discussion before including anything half-baked into Rails.

But this solution would obviously break expected behavior for some users who 
rely on what's been in AR since 2.3.3.

The two alternative solutions are:

B - port last summer's AR changes to Rails 3 AMo (would break AMo api though, 
see Mateos last mail)
C - try to implement a clean solution quickly enough to get it into Rails 3 beta

Personally I prefer option A because it's the most defensive one, but I still 
think it's a decision that should be guided by Rails core and we haven't gotten 
any feedback so far.



On Jan 21, 2010, at 8:41 PM, Mateo Murphy wrote:

> Here's a run down of the issues with porting the AR 2.3.5 validation code to 
> rails 3, for those who are curious about what the problem is:
> 
> in pre 3.0 versions of AR, all validation errors are kept in a single array, 
> which is wrapped by the AR::Errors object; in 2.3.3 these were changed from 
> strings to Error objects, but it didn't change the API because the user 
> didn't have direct access to the array of errors, and the errors were 
> converted to strings before being returned to the user.
> 
> in 3.0, validation errors are kept in multiple arrays, one per attribute, and 
> these are passed directly to the user for manipulation. This allows the 
> syntax errors[:attribute] << "message", but causes some issues with porting 
> the Error object, since the error arrays will then contain a mix of strings 
> and Error objects. Clearly this is not optimal for the end user, and 
> alternative is the wrap those arrays in objects that will take care of 
> converting from objects to strings and vice versa. However, having that 
> wrapper duplicate all of Array's functionality will take a lot of code (a 
> simple subset would be better), and having errors[:attribute] return 
> something other than an array breaks a LOT of tests.
> 
> To sum up, it's not possible to port the lazy translation functionality to AM 
> 3.0 without changing the API, and as sven said that's a decision that needs 
> to be guided by rails core.
> 
> 
> On 21-Jan-10, at 7:11 AM, Sven Fuchs wrote:
> 
>> Apparently validation error message i18n in ActiveModel master is not 
>> backwards compatible with ActiveRecord 2.3.5. AR has seen a bunch of changes 
>> [1] between 2.3.2 and 2.3.3 (iirc) which haven't been ported to AM.
>> 
>> José, Mateo and me have discussed this offlist and want to ask for other 
>> opinions.
>> 
>> On the one hand this breaks backwards compatibility and reintroduces 
>> problems with error message i18n that already were solved. On the other hand 
>> the solution was suboptimal anyway because we had to maintain backwards 
>> compatibility in 2.3.x ("bugfix" releases).
>> 
>> I guess we need a decision between
>> 
>> a) maintaining BC to AR 2.3.5 vs BC to AM 2.3.5 and
>> b) maintaining BC vs releasing Rails 3 beta soon.
>> 
>> I'm personally cool with any of these options but I feel the decision has to 
>> be made or guided by rails core.
>> 
>> 
>> 
>> [1] The changes we're talking about were related to what we've called "lazy 
>> translation" of error messages. I.e. previously validation error messages 
>> were translated when they were added to AR::Errors. We've changed this so 
>> they just were collected and only translated when they were accessed. This 
>> then allowed to treat messages and full_messages in the same way and stuff 
>> like that.
> 
> -- 
> 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.
> 
> 

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