I am trying to use the plugin in rails 2.0 preview mode and I am
getting the following error:
(undefined method `read_methods' for #<Class:0x33a421c>)
vendor/rails/activerecord/lib/active_record/base.rb:1282:in
`method_missing'
/usr/local/lib/ruby/gems/1.8/gems/composite_primary_keys-0.9.0/lib/
composite_primary_keys/base.rb:110:in `method_missing'
Any ideas ?
Thanks,
Fernand
Hi Nick,
I am trying to use the plugin in rails 2.0 preview mode and I am
getting the following error:
(undefined method `read_methods' for #<Class:0x33a421c>)
vendor/rails/activerecord/lib /active_record/base.rb:1282:in
`method_missing'
/usr/local/lib/ruby/gems/1.8/gems/composite_primary_keys-0.9.0/lib/
composite_primary_keys/base.rb:110:in `method_missing'
Any ideas ?
Thanks,
Fernand
http://drnicacademy.com - Ruby/Rails training around the world
http://drnicwilliams.com - Ruby/Rails/Javascript/Web2.0
skype: nicwilliams
(p) +61 412 002 126
(mail) PO Box 583, Ashgrove 4060, Queensland, Australia
I don't seem to have test_mysql for rake, either, or I'd post the
results, but I can give you a little bit of information: the results
of a debug session where I got the same error. Not sure how useful it
is, but the stack trace might be able to point you in the right
direction.
irb(#<UsersController:0x565a5b8>):158:0* @ar_join_object
=> #<UserAccount account_id: 1, user_id: 1, points: 3, created_at:
"2007
-10-20 13:05:27", updated_at: "2007-10-20 13:05:27">
irb(#<UsersController:0x565a5b8>):159:0> @ar_join_object.points
NoMethodError: undefined method `read_methods' for #<Class:0x55c4a18>
from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/
lib/active_
record/base.rb:1303:in `method_missing'
from c:/ruby/lib/ruby/gems/1.8/gems/
composite_primary_keys-0.9.0/lib/com
posite_primary_keys/base.rb:110:in `method_missing'
from (irb):159:in `call_filters'
from c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5.7919/lib/
action_co
ntroller/base.rb:1131:in `call_filters'
from c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5.7919/lib/
action_co
ntroller/filters.rb:689:in `perform_action_without_benchmark'
from c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5.7919/lib/
action_co
ntroller/benchmarking.rb:68:in `perform_action_without_rescue'
from c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
from c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5.7919/lib/
action_co
ntroller/benchmarking.rb:68:in `perform_action_without_rescue'
from c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5.7919/lib/
action_co
ntroller/rescue.rb:175:in `perform_action_without_caching'
from c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5.7919/lib/
action_co
ntroller/caching.rb:670:in `perform_action'
from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/
lib/active_
record/connection_adapters/abstract/query_cache.rb:33:in `cache'
from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/
lib/active_
record/query_cache.rb:8:in `cache'
from c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5.7919/lib/
action_co
ntroller/caching.rb:669:in `perform_action'
from c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5.7919/lib/
action_co
ntroller/base.rb:517:in `send'
from c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5.7919/lib/
action_co
ntroller/base.rb:517:in `process_without_filters'
from c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5.7919/lib/
action_co
ntroller/filters.rb:685:in
`process_without_session_management_support'
... 23 levels...
from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/lib/
mongrel/co
mmand.rb:211:in `run'
from c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.0.1-mswin32/bin/
mongrel_ra
ils:243
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4.7919/
lib/active_
support/dependencies.rb:489:in `load'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4.7919/
lib/active_
support/dependencies.rb:489:in `load'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4.7919/
lib/active_
support/dependencies.rb:342:in `new_constants_in'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4.7919/
lib/active_
support/dependencies.rb:489:in `load'
from c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5.7919/lib/
commands/server
s/mongrel.rb:64
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in `ge
m_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in `re
quire'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4.7919/
lib/active_
support/dependencies.rb:496:in `require'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4.7919/
lib/active_
support/dependencies.rb:342:in `new_constants_in'
from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4.7919/
lib/active_
support/dependencies.rb:496:in `require'
from c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5.7919/lib/
commands/server
.rb:39
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in `ge
m_original_require'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in `re
quire'
from script/server:3irb(#<UsersController:0x565a5b8>):160:0>
(rdb:5)
(rdb:5) ** INT signal received.
On Oct 18, 7:29 am, "Nic Williams" <drnicwilli...@gmail.com> wrote:
> Unfortunately I'm having some net problems and haven't run the CPK tests
> against 2.0pre nor edge rails in a while.
> Can someone else install 2.0 and run 'rake test_mysql'?
>
> On 10/18/07, DeRailed <fernand.gali...@gmail.com> wrote:
>
>
>
>
>
> > Hi Nick,
>
> > I am trying to use the plugin in rails 2.0 preview mode and I am
> > getting the following error:
>
> > (undefined method `read_methods' for #<Class:0x33a421c>)
> > vendor/rails/activerecord/lib/active_record/base.rb:1282:in
> > `method_missing'
> > /usr/local/lib/ruby/gems/1.8/gems/composite_primary_keys-0.9.0/lib/
> > composite_primary_keys/base.rb:110:in `method_missing'
>
> > Any ideas ?
>
> > Thanks,
> > Fernand
>
> --
> Dr Nic Williamshttp://drnicacademy.com- Ruby/Rails training around the worldhttp://drnicwilliams.com- Ruby/Rails/Javascript/Web2.0
It moves a whole heap of stuff (inc method_missing) that is monkey
patched in CPK.
That code (both AR and CPK) is a bit voodoo to me, so I'm not sure
what's going on.
Trying to get CPK tests running now...
Xavier
~/Code/composite_keys_trunk_clean/trunk> rake test_mysql
(in /Users/xavier/Code/composite_keys_trunk_clean/trunk)
/opt/local/bin/ruby -Ilib:test:test/connections/native_mysql "/opt/
local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/rake_test_loader.rb"
"test/test_associations.rb" "test/test_attributes.rb" "test/
test_clone.rb" "test/test_create.rb" "test/test_delete.rb" "test/
test_dummy.rb" "test/test_find.rb" "test/test_ids.rb" "test/
test_miscellaneous.rb" "test/test_pagination.rb" "test/
test_polymorphic.rb" "test/test_santiago.rb" "test/
test_tutorial_examle.rb" "test/test_update.rb"
Using native MySQL
Logging to /Users/xavier/Code/composite_keys_trunk_clean/trunk/log/
debug.log
Loaded suite /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake/
rake_test_loader
Started
...................E....FF./test/test_delete.rb:46: warning: Object#id
will be deprecated; use Object#object_id
E./test/test_delete.rb:52: warning: Object#id will be deprecated; use
Object#object_id
E../test/test_delete.rb:40: warning: Object#id will be deprecated; use
Object#object_id
E./test/test_delete.rb:34: warning: Object#id will be deprecated; use
Object#object_id
E.EEF.F./test/test_ids.rb:29: warning: Object#id will be deprecated;
use Object#object_id
E./test/test_ids.rb:35: warning: Object#id will be deprecated; use
Object#object_id
FF.EEE.E..........E
Finished in 0.299278 seconds.
1) Error:
test_create(TestCreate):
ActiveRecord::ProtectedAttributeAssignmentError: Can't mass-assign
these protected attributes: reference_type_id
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/
active_record/base.rb:2056:in
`remove_attributes_protected_from_mass_assignment'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/
active_record/base.rb:1858:in `attributes='
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/
active_record/base.rb:1685:in `initialize'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/
active_record/base.rb:467:in `new'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/
active_record/base.rb:467:in `create'
./test/test_create.rb:33:in `test_create'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_create.rb:32:in `test_create'
2) Failure:
test_delete_association(TestDelete) [./test/test_delete.rb:80]:
Employee count for department should be 2 before delete.
<2> expected but was
<0>.
3) Failure:
test_delete_many(TestDelete)
[./test/test_delete.rb:59:in `test_delete_many'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_delete.rb:57:in `test_delete_many']:
<2> expected but was
<0>.
4) Error:
test_delete_one(TestDelete):
IndexError: element size differs (1 should be 2)
./lib/composite_primary_keys/base.rb:214:in `transpose'
./lib/composite_primary_keys/base.rb:214:in `delete'
./lib/composite_primary_keys/base.rb:213:in `map'
./lib/composite_primary_keys/base.rb:213:in `delete'
./test/test_delete.rb:46:in `test_delete_one'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_delete.rb:45:in `test_delete_one'
5) Error:
test_delete_one_alone(TestDelete):
IndexError: element size differs (1 should be 2)
./lib/composite_primary_keys/base.rb:214:in `transpose'
./lib/composite_primary_keys/base.rb:214:in `delete'
./lib/composite_primary_keys/base.rb:213:in `map'
./lib/composite_primary_keys/base.rb:213:in `delete'
./test/test_delete.rb:52:in `test_delete_one_alone'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_delete.rb:51:in `test_delete_one_alone'
6) Error:
test_destroy_one_alone_via_class(TestDelete):
RuntimeError: [4]: Incorrect number of primary keys for ReferenceCode:
[:reference_type_id, :reference_code]
./lib/composite_primary_keys/base.rb:286:in `find_from_ids'
./lib/composite_primary_keys/base.rb:281:in `each'
./lib/composite_primary_keys/base.rb:281:in `find_from_ids'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/
active_record/base.rb:437:in `find'
./lib/composite_primary_keys/base.rb:230:in `destroy'
./test/test_delete.rb:40:in `test_destroy_one_alone_via_class'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_delete.rb:39:in `test_destroy_one_alone_via_class'
7) Error:
test_destroy_one_via_class(TestDelete):
RuntimeError: [4]: Incorrect number of primary keys for ReferenceCode:
[:reference_type_id, :reference_code]
./lib/composite_primary_keys/base.rb:286:in `find_from_ids'
./lib/composite_primary_keys/base.rb:281:in `each'
./lib/composite_primary_keys/base.rb:281:in `find_from_ids'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/
active_record/base.rb:437:in `find'
./lib/composite_primary_keys/base.rb:230:in `destroy'
./test/test_delete.rb:34:in `test_destroy_one_via_class'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_delete.rb:33:in `test_destroy_one_via_class'
8) Error:
test_find(TestFind):
ActiveRecord::RecordNotFound: Couldn't find all ReferenceCodes with
IDs ([[1, 1]])reference_codes.reference_type_id=1 AND
reference_codes.reference_code=1
./lib/composite_primary_keys/base.rb:309:in `find_from_ids'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/
active_record/base.rb:437:in `find'
./test/test_find.rb:38:in `test_find'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_find.rb:37:in `test_find'
9) Error:
test_find_composite_ids(TestFind):
ActiveRecord::RecordNotFound: Couldn't find all ReferenceCodes with
IDs ([[1, 1]])reference_codes.reference_type_id=1 AND
reference_codes.reference_code=1
./lib/composite_primary_keys/base.rb:309:in `find_from_ids'
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.15.5.7919/lib/
active_record/base.rb:437:in `find'
./test/test_find.rb:48:in `test_find_composite_ids'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_find.rb:47:in `test_find_composite_ids'
10) Failure:
test_find_first(TestFind)
[./test/test_find.rb:31:in `test_find_first'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_find.rb:29:in `test_find_first']:
<nil> is not true.
11) Failure:
test_to_param(TestFind)
[./test/test_find.rb:58:in `test_to_param'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_find.rb:57:in `test_to_param']:
<"1,1"> expected but was
<"">.
12) Error:
test_id(TestIds):
NoMethodError: undefined method `ids' for nil:NilClass
./test/test_ids.rb:29:in `test_id'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_ids.rb:28:in `test_id'
13) Failure:
test_id_to_s(TestIds)
[./test/test_ids.rb:35:in `test_id_to_s'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_ids.rb:34:in `test_id_to_s']:
<"1,1"> expected but was
<"4">.
14) Failure:
test_ids_to_s(TestIds)
[./test/test_ids.rb:44:in `test_ids_to_s'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_ids.rb:41:in `test_ids_to_s']:
<"(1,1),(1,2)"> expected but was
<"">.
15) Error:
test_set_ids_array(TestIds):
NoMethodError: undefined method `id=' for nil:NilClass
./test/test_ids.rb:62:in `test_set_ids_array'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_ids.rb:59:in `test_set_ids_array'
16) Error:
test_set_ids_comp(TestIds):
NoMethodError: undefined method `id=' for nil:NilClass
./test/test_ids.rb:71:in `test_set_ids_comp'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_ids.rb:68:in `test_set_ids_comp'
17) Error:
test_set_ids_string(TestIds):
NoMethodError: undefined method `id=' for nil:NilClass
./test/test_ids.rb:53:in `test_set_ids_string'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_ids.rb:50:in `test_set_ids_string'
18) Error:
test_composite_instance(TestMiscellaneous):
NoMethodError: undefined method `composite?' for nil:NilClass
./test/test_miscellaneous.rb:31:in `test_composite_instance'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_miscellaneous.rb:30:in `test_composite_instance'
19) Error:
test_update_attributes(TestUpdate):
NoMethodError: undefined method `update_attributes' for nil:NilClass
./test/test_update.rb:33:in `test_update_attributes'
./test/abstract_unit.rb:65:in `testing_with'
./test/abstract_unit.rb:60:in `each'
./test/abstract_unit.rb:60:in `testing_with'
./test/test_update.rb:32:in `test_update_attributes'
57 tests, 144 assertions, 6 failures, 13 errors
Cheers, sam
Come on team, some interested into hunting down this defect?
Tally-ho!
Nic
On 11/9/07, Sam Lown <sam....@gmail.com> wrote:
>
> Is there any news on this yet, as I'm having similar problems.
>
> Cheers, sam
>
>
> >
>
--
Dr Nic Williams
http://drnicacademy.com - Ruby/Rails training/dev around the world
http://drnicwilliams.com - Ruby/Rails/Javascript/Web2.0
(skype) nicwilliams
(p) +61 412 002 126 / +61 7 3113 3033
(mail) PO Box 583 Ashgrove 4060 QLD Aus
http://compositekeys.googlegroups.com/web/fix_tests.patch
The new fixture caching that was put in to 2.0 made this bug shine
through. The problem was that setup_with_fixtures never got past the
first check in fixtures.rb...
return unless defined?(ActiveRecord::Base) && !
ActiveRecord::Base.configurations.blank?
...due to ActiveRecord::Base.configurations always being blank. That
is why the fixture method in the tests never worked and you had to
explicitly call create_fixtures in each test setup. I changed
load_connection_from_env to set the ActiveRecord::Base.configurations
based on the 'cpk_adapters' variable and all was well. I'm not exactly
sure why the create_fixtures call in each test and the caching broke
things, nor do I really care since now the tests/fixtures behave like
they are supposed to.
I've only tested this with Oracle on rails 1.2.2 and 2.0.0_PR.
Darrin
On Nov 8, 4:08 pm, "Nic Williams" <drnicwilli...@gmail.com> wrote:
> I haven't had/made time to look at this. I've been on the RubiGen
> crusade recently @ RubyConf.
>
> Come on team, some interested into hunting down this defect?
>
> Tally-ho!
>
> Nic
>
> On 11/9/07, Sam Lown <sam.l...@gmail.com> wrote:
>
>
>
> > Is there any news on this yet, as I'm having similar problems.
>
> > Cheers, sam
>
> --
> Dr Nic Williamshttp://drnicacademy.com- Ruby/Rails training/dev around the worldhttp://drnicwilliams.com- Ruby/Rails/Javascript/Web2.0
Thanks,
Darrin
http://drnicacademy.com - Ruby/Rails training/dev around the world
http://drnicwilliams.com - Ruby/Rails/Javascript/Web2.0
Hello all. I have just tested this change and it solved the "undefined
method `read_methods'" for me.
For the record, before running 'rake local_deploy' I had to do this:
$ svn checkout svn://rubyforge.org/var/svn/compositekeys/trunk
$ cd trunk
$ sudo gem install hoe --include-dependencies
$ sudo gem install syntax --include-dependencies
$ mkdir tmp
Then create and run this ruby program:
require 'rubygems'
require 'sqlite3'
db = SQLite3::Database.new('./tmp/test.db')
And finally:
$ rake --trace local_deploy
Regards,
Gustavo Delfino
http://drnicwilliams.com - Ruby/Rails/Javascript/Web2.0