Delaying table attribute load using ActiveRecord


#1

Hi all,

I came accross the following problem lately: I got a table with several
BLOB fields (Oracle DB) and I have ActiveRecord reading those fields
whenever records are loaded using finder methods. This behavior is just
fine in 99.9% of the time, but considering BLOB data is not small, it is
considerably slowing down search access :(.

So basically, I thought about building a :has_one relationship and add
an extra table table holding BLOB value so as to cope with the pb. I
found it painfull and not very ‘RoRy’, so I decided to hack
ActiveRecord::Base so as to delay the attribute load… and it works !
Attributes are dynamicaly loaded whenever client application accesses
them explicitely.

Syntax looks like the following:

class A < ActiveRecord::Base
delay_attributes :foo, :bar

end

Now I got two questions:

  • as I am new Rails (and Ruby as well): I am wondering if I am missing
    something concerning ActiveRecord usage (meaning this hack is useless),
  • if this patch is a good idea, I’d like to submit it to the
    maintainers of the project, but I don’t know what is the exact procedure
    to do so.

Thx


#2

This post is probably more suitable for the main rails list.

  • james

On 4/1/06, Laurent L. removed_email_address@domain.invalid wrote:

found it painfull and not very ‘RoRy’, so I decided to hack


Posted via http://www.ruby-forum.com/.


engine-developers mailing list
removed_email_address@domain.invalid
http://lists.rails-engines.org/listinfo.cgi/engine-developers-rails-engines.org

  • J *
    ~

#3

Done.

Thx

James A. wrote:

This post is probably more suitable for the main rails list.

  • james

On 4/1/06, Laurent L. removed_email_address@domain.invalid wrote:

found it painfull and not very ‘RoRy’, so I decided to hack


Posted via http://www.ruby-forum.com/.


engine-developers mailing list
removed_email_address@domain.invalid
http://lists.rails-engines.org/listinfo.cgi/engine-developers-rails-engines.org

  • J *
    ~