Re: Overwrite active_record find?

Christian Kerth
Thu, 29 May 2008 12:34:59 -0000

Frederick Cheung wrote:

> You need to say super(*args). alias_method_chain is usually a more
> prudent choice for this sort of stuff (and i assume you know that this
> won''t accomplish anything if you''re using a pack of
mongrels or
> whatever - I suppose it would work if you had a single multithreaded
> script, but I''m still not sure what the point would be)
>
> Fred

Problem is I''m using active_record without rails on a application that
includes a mini http server (built on top of webrick) and a background
task. Both operate on the same sqlite db. Because of concurrency issues
with sql I''m trying to synchronize access to the database.

Iven with super(*args) i still get the error:

c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1227:in
`find_initial'': undefined method `first'' for nil:NilClass
(NoMethodError)
        from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1514:in
`send''
        from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1514:in
`find_by_requesttype_and_requeststatus''

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