I have a Rails 3.1 app and I use DataMapper as ORM. I have following models (stripped):
class Task include DataMapper::Resource belongs_to :group end class Group include DataMapper::Resource belongs_to :project has n, :tasks end class Project include DataMapper::Resource has n, :groups end I found out that DataMapper retreives data in a different way when app is run as a server and console. When run as server it tries to retrieve a Group record, result is like this (see project_id): #<Group @id=4 @created_at=Fri, 19 Apr 2013 06:13:25 +0000 @updated_at=Fri, 19 Apr 2013 06:13:25 +0000 @name="In Progress" @weight=<not loaded> @sync_updated_at=<not loaded> @sync_created_at=<not loaded> @capacity=<not loaded> @project_id=nil> When run as console, and retreived manually via Group.get(4), result is like this (see project_id): #<Group @id=4 @created_at=Fri, 19 Apr 2013 06:13:25 +0000 @updated_at=Fri, 19 Apr 2013 06:13:25 +0000 @name="In Progress" @weight=<not loaded> @sync_updated_at=<not loaded> @sync_created_at=<not loaded> @capacity=<not loaded> @project_id=1> Methods are not monkey patched: 1.9.1 :060 > Group.instance_method(:project).source_location => ["/var/www/kanbanery/shared/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/model/relationship.rb", 333] 1.9.1 :061 > Group.instance_method(:project_id).source_location => ["/var/www/kanbanery/shared/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/model/property.rb", 206] 1.9.1 :062 > Group.instance_method(:project_id=).source_location => ["/var/www/kanbanery/shared/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/model/property.rb", 235] 1.9.1 :063 > Group.instance_method(:project=).source_location => ["/var/www/kanbanery/shared/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/model/relationship.rb", 358] Any ideas what can cause such difference? Marcin -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To unsubscribe from this group and stop receiving emails from it, send an email to datamapper+unsubscr...@googlegroups.com. To post to this group, send email to datamapper@googlegroups.com. Visit this group at http://groups.google.com/group/datamapper?hl=en. For more options, visit https://groups.google.com/groups/opt_out.