
dm-types: issues with Json, FilePath, IPAddress types
Reported by kgiszczak | May 22nd, 2010 @ 11:16 AM
Models aren't saved when property with one of this type is
set.
There's no problem with other types.
Gemfile:
source 'http://rubygems.org'
gem 'dm-migrations', '~> 1.0.0.rc2', :git => 'git://github.com/datamapper/dm-migrations.git'
gem 'dm-types', '~> 1.0.0.rc2', :git => 'git://github.com/datamapper/dm-types.git'
gem 'dm-postgres-adapter', '~> 1.0.0.rc2', :git => 'git://github.com/datamapper/dm-postgres-adapter.git'
gem 'dm-mysql-adapter', '~> 1.0.0.rc2', :git => 'git://github.com/datamapper/dm-mysql-adapter.git'
gem 'dm-sqlite-adapter', '~> 1.0.0.rc2', :git => 'git://github.com/datamapper/dm-sqlite-adapter.git'
gem 'dm-core', '~> 1.0.0.rc2', :git => 'git://github.com/datamapper/dm-core.git'
gem 'dm-do-adapter', '~> 1.0.0.rc2', :git => 'git://github.com/datamapper/dm-do-adapter.git'
gem 'json'
test.rb:
require 'bundler'
Bundler.setup
Bundler.require(:default)
DataMapper.setup(:default, 'postgres://postgres@localhost/test')
# DataMapper.setup(:default, 'mysql://root@localhost/test')
# DataMapper.setup(:default, 'sqlite3::memory:')
class ModelIpAddress
include DataMapper::Resource
property :id, Serial
property :addr, IPAddress
end
class ModelFilePath
include DataMapper::Resource
property :id, Serial
property :body, FilePath
end
class ModelJson
include DataMapper::Resource
property :id, Serial
property :body, Json
end
DataMapper.auto_migrate!
record = ModelIpAddress.new :addr => '127.0.0.1'
p record # => #<ModelIpAddress @id=nil @addr=#<IPAddr: IPv4:127.0.0.1/255.255.255.255>>
p record.save # => true
p ModelIpAddress.all # => []
record = ModelFilePath.new :body => '/usr/local'
p record # => #<ModelFilePath @id=nil @body=#<Pathname:/usr/local>>
p record.save # => true
p ModelFilePath.all # => []
record = ModelJson.new :body => { :tast => "test" }
p record # => #<ModelJson @id=nil @body={:tast=>"test"}>
p record.save # => true
p ModelJson.all # => []
Comments and changes to this ticket
-
Dan Kubb (dkubb) May 22nd, 2010 @ 03:56 PM
- State changed from new to unconfirmed
- Assigned user set to Piotr Solnica (solnic)
-
Piotr Solnica (solnic) May 24th, 2010 @ 07:06 AM
- State changed from unconfirmed to confirmed
-
Piotr Solnica (solnic) May 25th, 2010 @ 04:25 AM
- State changed from confirmed to resolved
(from [c92005b5e5915df8d9602d49a13ce97b7fcb973c]) Override Property#valid? for FilePath, IpAddress and Json types
[#1285 state:resolved] http://github.com/datamapper/dm-types/commit/c92005b5e5915df8d9602d...
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
Referenced by
-
1285 dm-types: issues with Json, FilePath, IPAddress types [#1285 state:resolved] http://github.com/datamapper/dm-t...