2009-11-03 4 views
1

Vestal Versions (http://github.com/laserlemon/vestal_versions)에서 버그를 발견했을 수도 있습니다. revert_to의 동작은 과거에 수행 한 되돌림에 따라 다릅니다. 같은 대상으로 (- 포섬 \ 연주 "가게에서"-Vestal Versions에서 버그입니까? 아니면 뭔가 잘못하고 있습니다.

>> a = Annotation.find(1384) 
=> #<Annotation id: 1384, body: "Just hanging out -- \"playing possum\" -- at the stor...", last_updated_by_id: 3, created_by_id: 3, song_id: 30, deleted_at: nil, created_at: "2009-09-06 01:56:55", updated_at: "2009-10-27 22:02:35", referent: "in the spot playing possum\nDebating my destination,...", vote_score: 0> 
>> a.revert_to(9) 
=> 9 
>> a.body 
=> #<RDiscount:0x21cf7bc @filter_styles=true, @smart=true, @fold_lines=nil, @filter_html=nil, @text="Just hanging out -- \"playing possum\" -- at the store, lacing up the new Nikes, trying to decide where to go for dinner"> 


>> a = Annotation.find(1384) 
=> #<Annotation id: 1384, body: "Just hanging out -- \"playing possum\" -- at the stor...", last_updated_by_id: 3, created_by_id: 3, song_id: 30, deleted_at: nil, created_at: "2009-09-06 01:56:55", updated_at: "2009-10-27 22:02:35", referent: "in the spot playing possum\nDebating my destination,...", vote_score: 0> 
>> a.revert_to(8) 
=> 8 
>> a.body 
=> #<RDiscount:0x21b5a10 @filter_styles=true, @smart=true, @fold_lines=nil, @filter_html=nil, @text="I.e. just hanging out -- \"playing possum\" -- in the living room, lacing up the new Nikes, trying to decide where to go for dinner"> 
>> a.revert_to(:last) 
=> 11 
>> a.revert_to(9) 
=> 9 
>> a.body 
=> #<RDiscount:0x21b5a10 @filter_styles=true, @smart=true, @fold_lines=nil, @filter_html=nil, @text="I.e. just hanging out -- \"playing possum\" -- in the living room, lacing up the new Nikes, trying to decide where to go for dinner"> 

즉, 내가 갓로드 주석에서 revert_to(9) 몸 필드는 그 텍스트 \ "그냥 놀고"시작하는 RDiscount 개체가 포함되어있는 경우 예를 들면 다음과 같습니다이다 몸은 내가 갓로드 주석에서 revert_to(8)로 되돌릴 경우 버전 9에 잘못 반면, (주석의 몸, revert_to(:last)revert_to(9), 주석의 시신을 확인

그러나 버전 9)의로 무엇 인 그것 버전 8의 특수 효과 본문과 일치합니다.)

모두 생각?

답변

3

이것은 vestal_versions의 버그는 아니며, 버전을 변경 한 후에도 레일이 연결을 다시로드하지 않습니다. 당신이 가져

  1. Annotation "는"X의 RDiscount ID로 : 가정 당신의 AnnotationRDiscount 다음과 같은 일이 발생에 ID를 보유하고 있습니다.
  2. "a"를 이전 버전으로 되 돌리면 RDiscount id가 y로 변경됩니다.
  3. a.body을 호출하여 레일스가 RDiscount 개체를 ID y로로드하게합니다.
  4. "a"를 :last으로 되 돌리면 RDiscount id가 다시 x로 변경됩니다.
  5. a.body을 다시 호출하지만 레일스에 이미 RDiscount 개체가로드되어이 개체가 반환됩니다.
+0

좋은 전화 - 해결 방법을 생각해 볼 수 있습니까? –

+0

다음과 같이 협회를 호출 할 수 있습니다. a.body (true). 이것은 레일스가 db로부터 연관을 가져 오도록합니다. 근원 버전을 사용하는 다른 방법이있을 수 있지만, 나는 그 순간에 멋진 것을 생각할 수 없다. – Calavera

관련 문제