#1408 ✓not-applicable
Postmodern

default_scope.update(:order => nil) and calling Model.last raises an exception.

Reported by Postmodern | September 11th, 2010 @ 01:28 AM | in 1.1

I tried to disable all ordering on a Model who's primary key is a String. I tried to do this by using default_scope.

class SchemaMigration

  include DataMapper::Resource

  storage_names[:default] = 'schema_migrations'

  default_scope.update(:order => nil)

  property :version, String, :key => true

end

When I called SchemaMigration.last, I got this exception:

NoMethodError: undefined method `map!' for nil:NilClass
    from /home/hal/.rvm/gems/ruby-1.9.2-p0/gems/dm-core-1.0.2/lib/dm-core/query.rb:327:in `reverse!'
    from /home/hal/.rvm/gems/ruby-1.9.2-p0/gems/dm-core-1.0.2/lib/dm-core/model.rb:410:in `last'

Comments and changes to this ticket

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 »

Pages