#492 ✓resolved
Ardekantur

DM mistakes singular words for plural

Reported by Ardekantur | July 30th, 2008 @ 07:59 PM

class Entry
  include DataMapper::Resource
  property :id,           Integer, :serial => true
  property :title,        Text  
  has 1, :status
end

class Status
  include DataMapper::Resource
  property :id,           Integer, :serial => true
  property :name,         Text
end

Trying to run this code provides the following error:

vz_taskforce $ ruby vz_taskforce.rb
/Library/Ruby/Gems/1.8/gems/dm-core-0.9.3/lib/dm-core/associations/relationship.rb:72:in `child_model': Cannot find the child_model Statu for Entry (NameError)
	from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.3/lib/dm-core/associations/relationship.rb:15:in `child_key'
	from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.3/lib/dm-core/model.rb:185:in `properties_with_subclasses'
	from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.3/lib/dm-core/model.rb:185:in `each_value'
	from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.3/lib/dm-core/model.rb:185:in `properties_with_subclasses'
	from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/set.rb:189:in `each'
	from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/set.rb:189:in `each_key'
	from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/set.rb:189:in `each'
	from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.3/lib/dm-core/model.rb:184:in `properties_with_subclasses'
	 ... 11 levels...
	from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.3/lib/dm-core/auto_migrations.rb:12:in `auto_migrate'
	from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.3/lib/dm-core/repository.rb:131:in `auto_migrate!'
	from /Library/Ruby/Gems/1.8/gems/dm-core-0.9.3/lib/dm-core.rb:204:in `auto_migrate!'

DM is trying to look for a Statu object, which I guess it imagines is the singular of Status.

Comments and changes to this ticket

  • Bernerd Schaefer

    Bernerd Schaefer August 1st, 2008 @ 09:42 AM

    • State changed from “new” to “resolved”

    Thanks for the catch. This is now fixed on edge (extlib commit da2ff86).

    Since you're running on the gem, you can fix this yourself by putting it in your app's config files:

    English::Inflect.singular_word "status", "status"
    
  • lobo_tuerto

    lobo_tuerto September 4th, 2008 @ 12:44 PM

    It fails with "Address".

    Maybe not trying to get a singular form when using #has 1, would help with all the words that end in "s" in singular form?

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 »

People watching this ticket

Referenced by

Pages