Hi ara (Ara, a, ... which is the best salutation?),
There appears to be an incompatibility between arrayfields and active
record dynamic finders.
I've filed a bug report here:
http://rubyforge.org/tracker/index.p...1024&atid=4025
but I'm also posting it here to get a wider audience.
I'm using rails 1.2.3. After loading arrayfields 4.1.0 the active
record dynamic finders "find_by_ ..." are broken.
Here's a simple test showing the dynamic finder working, requiring
arrayfields, and then the dynamic finder stops working.
$ script/console
Loading development environment.
>>
>>OtmlFile.find_by_path("../../concord/otrunk-examples/BasicExamples/basic_drawing.otml")
=> #<OtmlFile:0x330ebf4 @attributes={"name"=>"basic_drawing.otml",
"id"=>"1",
"path"=>"../../concord/otrunk-examples/BasicExamples/basic_drawing.otml"}>
>> require 'arrayfields'
=> ["PseudoHash", "Arrayfields", "Pseudohash", "Fieldable",
"FieldedArray", "ArrayFields", "Fieldedarray"]
>>
>>OtmlFile.find_by_path("../../concord/otrunk-examples/BasicExamples/basic_drawing.otml")
ArgumentError: <nil> not inject-able
from
/usr/local/lib/ruby/gems/1.8/gems/arrayfields-4.1.0/lib/arrayfields.rb:28:in
`initialize'
from
/usr/local/lib/ruby/gems/1.8/gems/arrayfields-4.1.0/lib/arrayfields.rb:16:in
`new'
from
/usr/local/lib/ruby/gems/1.8/gems/arrayfields-4.1.0/lib/arrayfields.rb:16:in
`new'
from
/usr/local/lib/ruby/gems/1.8/gems/arrayfields-4.1.0/lib/arrayfields.rb:286:in
`fields='
from
/usr/local/lib/ruby/gems/1.8/gems/arrayfields-4.1.0/lib/arrayfields.rb:305:in
`dup'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1426:in
`replace_bind_variables'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1405:in
`sanitize_sql_hash'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1388:in
`sanitize_sql'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1163:in
`add_conditions!'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1096:in
`construct_finder_sql'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:997:in
`find_every'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:991:in
`find_initial'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1204:in
`send'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1204:in
`method_missing'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/deprecation.rb:44:in
`silence'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/base.rb:1204:in
`method_missing'
from (irb):3>>