You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.
/pr/tasks/ruby/datamapper/dm/dm-core/lib/dm-core/property.rb:712:in `assert_valid_value': Invalid value nil for property :body (DataMapper::Property::Text) on model Post (DataMapper::Property::InvalidValueError)
CODE:
# encoding: UTF-8
require 'dm-core'
$DATA_MAPPER_MYSQL_CONNECTION = 'mysql://root:mysqlpage@localhost/datamapper'
# If you want the logs displayed you have to do this before the call to setup
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, $DATA_MAPPER_MYSQL_CONNECTION )
# by default all fields are required
DataMapper::Property.required(true)
DataMapper::Property::String.length(120)
DataMapper::Property::Boolean.allow_nil(false)
DataMapper::Model.raise_on_save_failure = true
class Post
include DataMapper::Resource
property :id, Serial
property :title, String
property :body, Text
end
DataMapper.finalize
require 'dm-migrations'
DataMapper.auto_upgrade!
if Post.first
puts "phase2 editing post"
post = Post.first
post.title = "dummy"
# this causes an exception because body porperty is nil because its loaded lazily !?
post.save
else
puts "creating post, rerun script!"
post = Post.create({
:title => "My first DataMapper post",
:body => "A lot of text ...",
})
end
# repository(:default).adapter.execute('COMMIT')
This causes the feeling that the mysql backend (and maybe all?) are still kind of unstable.
Tell me if I should file this bug against a different github repo.. maybe its not related to mysql at all.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
sample code derived from http://datamapper.org/docs/create_and_destroy.html,
When you run it the second time you'll get the error:
CODE:
This causes the feeling that the mysql backend (and maybe all?) are still kind of unstable.
Tell me if I should file this bug against a different github repo.. maybe its not related to mysql at all.
The text was updated successfully, but these errors were encountered: