#23 new
johnf

ActiveRecord::Base subclasses in rails3 returns a string

Reported by johnf | June 24th, 2010 @ 09:04 AM

In rails 3 :ActiveRecord::Base.send(:subclasses) returns an array of strings rather than classes.

This means you see the error below. Adding a whole heap of constantize calls around the place seems to fix things

undefined method abstract_class?' for "Keyword":String (NoMethodError)<br/> /home/johnf/.rubygems/1.9.1/gems/pickle-0.3.0/lib/pickle/adapters/active_record.rb:22:inblock in model_classes' /home/johnf/.rubygems/1.9.1/gems/pickle-0.3.0/lib/pickle/adapters/active_record.rb:21:in select' /home/johnf/.rubygems/1.9.1/gems/pickle-0.3.0/lib/pickle/adapters/active_record.rb:21:inmodel_classes' /home/johnf/.rubygems/1.9.1/gems/pickle-0.3.0/lib/pickle/adapter.rb:115:in factories' /home/johnf/.rubygems/1.9.1/gems/pickle-0.3.0/lib/pickle/config.rb:25:inblock in factories' /home/johnf/.rubygems/1.9.1/gems/pickle-0.3.0/lib/pickle/config.rb:24:in each' /home/johnf/.rubygems/1.9.1/gems/pickle-0.3.0/lib/pickle/config.rb:24:ininject' /home/johnf/.rubygems/1.9.1/gems/pickle-0.3.0/lib/pickle/config.rb:24:in factories' /home/johnf/.rubygems/1.9.1/gems/pickle-0.3.0/lib/pickle/parser/matchers.rb:41:inmatch_factory' /home/johnf/.rubygems/1.9.1/gems/pickle-0.3.0/lib/pickle/parser/matchers.rb:49:in match_indexed_model' /home/johnf/.rubygems/1.9.1/gems/pickle-0.3.0/lib/pickle/parser/matchers.rb:57:inmatch_model' (eval):2:in capture_model'

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Assign tickets to <b>Ian White</b>, so I get notified

People watching this ticket

Pages