Michael Koziarski wrote:
>> Your proposal looks sound to me, however I think it only goes half
>> way. In my view there are two main issues with active record:
>>
>> * The mixing of Ruby objects and raw database values (strings) in the
>> attributes hash table
>>
>> * The lack of proper column objects
>>     
>
> The column objects we currently have are certainly anemic, and I agree
> it'd be nice if the type casting code was pushed out of Base and into
> the adapters.  All things in good time, assuming the caching approach
> works, I'd definitely like to tidy the implementation a little more.
> I definitely like the general shape of:
>
>  attributes_cache['foo'] = self.columns['foo'].serialize(attributes['foo'])
>
> So assuming we don't see any breakage, I'll investigate that kind of a change.
>
>   
>> Last, it would be really useful to add a "changed" flag for each field
>> in each record. Then when ActiveRecord creates an UPDATE query it
>> would only modify the values that actually changed. Right now,
>> ActiveRecord updates all columns, which turns out to be a pain because
>> it has a tendency to botch values for columns that have a default
>> expression or have a type that it doesn't know about (postgis fields
>> for example).
>>     
>
> We've discussed partial-row updates in the past here, and they're
> incompatible with model  validations.   Concurrent updates can each
> see a valid state, issue an update, and leave the record invalid.  So
> it's unlikely we'll support them within the 2.0 timeframe, however it
> could definitely be put into a plugin, and I'm happy to roll in any
> hooks needed to simplify that.
>   
What about requiring optimistic locking for partial row updates? That 
would seem to allow it to work without greatly contorting the rest of 
ActiveRecord.
> As for change tracking,  jeremy has had a plugin around for ages
> (http://code.bitsweat.net/svn/dirty/) which does the job nicely the
> few times I've used it.  The fact it hasn't gathered a large number of
> users indicates to me that perhaps it's a bit of a niche feature.
>
>
>   
>> So just my two cents - happy to discuss more if these seem like useful
>> ideas.
>>
>> Charlie
>>
>>
>>     
>
>
>   
Jack

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