
problem accessing models with ParanoidBoolean attributes
Reported by Deleted User | June 26th, 2009 @ 01:49 PM | in 0.10.0
illustrated by the following code:
require 'rubygems'
require 'dm-core'
class User
include DataMapper::Resource
property :id, Serial
property :deleted, ParanoidBoolean, :default => false
end
DataMapper.setup(:default, "sqlite3::memory:")
User.auto_migrate!
User.create!
puts User.all.inspect # => []
Comments and changes to this ticket
-
Deleted User June 26th, 2009 @ 01:57 PM
The problem seems to be in building the EqualToComparison condition where it checks valid_value? which in turn checks that the value is valid on the property:
dm-core-0.10.0/lib/dm-core/property.rb:759
def valid?(value) value.kind_of?(primitive) || (value.nil? && nullable?) end
where primative is TrueClass and value is false which results in valid? returning false.
-
-
Dan Kubb (dkubb) June 27th, 2009 @ 04:03 AM
- State changed from new to resolved
(from [9d3a1f1a8e63b5d977c211b410bb27735ec82640]) Fixed bug where false was not considered valid for a Boolean property
- Refactored primitive test for values
- Updated boolean typecasting to be more precise
- Added specs for typecasting boolean property values
- Added specs for validating boolean property values
- Added specs for conditions with values that need to be coerced to match the property
[#924 state:resolved] [#927 state:resolved] http://github.com/datamapper/dm-core/commit/9d3a1f1a8e63b5d977c211b...
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.
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
- Nobody is watching this ticket.
Referenced by
-
924 We can't made search with false result This is the same issue as in ticket #927 but for the Bool...
-
924 We can't made search with false result [#924 state:resolved] [#927 state:resolved] http://githu...
-
927 problem accessing models with ParanoidBoolean attributes [#924 state:resolved] [#927 state:resolved] http://githu...