Project

General

Profile

Model Issue is getting spoiled

Added by Dmitri Kouikoff about 15 years ago

Hello!
I've met a problem that is described at http://www.redmine.org/issues/3725
Additionally I may add that the test work_piece.issue.class == Issue fails at the second request.


Replies (3)

RE: Model Issue is getting spoiled - Added by Dmitri Kouikoff about 15 years ago

Issue is reloaded while WorkPiece.first.issue remains the same

$ ./script/console
Loading development environment (Rails 2.2.2)
>> WorkPiece.first.issue.class.__id__ == Issue.__id__
=> true
>> reload!
Reloading...
=> true
>> WorkPiece.first.issue.class.__id__ == Issue.__id__
=> false

RE: Model Issue is getting spoiled - Added by Dmitri Kouikoff about 15 years ago

Moreover, WorkPiece also belongs to User

class WorkPiece < ActiveRecord::Base
  belongs_to :user
  belongs_to :issue
end

and for User everything is OK
$ ./script/console
Loading development environment (Rails 2.2.2)
>> WorkPiece.first.user.class.__id__ == User.__id__
=> true
>> reload!
Reloading...
=> true
>> WorkPiece.first.user.class.__id__ == User.__id__
=> true

RE: Model Issue is getting spoiled - Added by Eric Davis about 15 years ago

What if you add unloadable to WorkPiece?

class WorkPiece < ActiveRecord::Base
  unloadable

  belongs_to :user
  belongs_to :issue
end

Eric Davis

    (1-3/3)