
Accessing has 1-relationship results in stacklevel too deep
Reported by Sindre Aarsaether | May 22nd, 2009 @ 09:30 AM
Example:
require 'rubygems'
require 'dm-core'
DataMapper.setup(:default,
:adapter => 'mysql',
:host => 'localhost',
:username => 'root',
:database => 'dm_core_test',
:encoding => 'utf8'
)
DataObjects::Mysql.logger = DataObjects::Logger.new(STDOUT, :debug)
class User
include DataMapper::Resource
property :id, Serial
property :login, String #, :writer => :private
property :name, String, :length => 255
has 1, :account, :active => true
end
class Account
include DataMapper::Resource
property :id, Serial
property :active, Boolean
belongs_to :user
end
User.auto_migrate!
Account.auto_migrate!
u = User.create(:name => "somebee")
u2 = User.create(:name => "somebee2")
u3 = User.create(:name => "somebee3")
Account.create(:user => u)
Account.create(:user => u, :active => true)
puts User.all.first.account
# => stack level too deep
Comments and changes to this ticket
-
Dan Kubb (dkubb) May 22nd, 2009 @ 12:07 PM
- Assigned user set to Dan Kubb (dkubb)
- State changed from unconfirmed to confirmed
-
Dan Kubb (dkubb) May 23rd, 2009 @ 10:43 AM
Attached is a patch that I believe fixes the problem. Can you give it a try and let me know if it does?
Once I can work out a way to spec this in the current setup, I'll push this to the repository, assuming it's fixed for you.
-
Dan Kubb (dkubb) May 26th, 2009 @ 02:59 AM
- State changed from confirmed to resolved
(from [d3aba1f36307afa6f478bcb0aa692ba2842af9a3]) Fixed problem with SEL and accessor causing stacktrace error
[#858 state:resolved] http://github.com/datamapper/dm-core/commit/d3aba1f36307afa6f478bcb...
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
Attachments
Tags
Referenced by
-
858 Accessing has 1-relationship results in stacklevel too deep [#858 state:resolved] http://github.com/datamapper/dm-co...