Created
December 22, 2010 13:24
-
-
Save tomas-stefano/751491 to your computer and use it in GitHub Desktop.
Attempt to Reproduce the bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####### ONLY DataMapper ####### | |
>> episodes = Episode.all | |
[#<Episode @id=1 @title="Cache Variable">, #<Episode @id=2 @title="Cache Variable"> , #<Episode @id=3 @title="Cache Variable">] | |
>> episode = episodes.shift | |
>> episodes.each do |e| | |
>> puts e.id | |
>> end | |
1 | |
2 | |
3 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### HAML AND DATAMAPPER ###### | |
### Assuming that @episodes is: | |
# | |
# [#<Episode @id=1 @title="Cache Variable">, #<Episode @id=2 @title="Cache Variable"> , #<Episode @id=3 @title="Cache Variable">] | |
# | |
#current_episode | |
- unless @episodes.empty? | |
- @episode = @episodes.shift | |
%h3 | |
= "Episódio #{@episode.id} - #{@episode.title}" | |
%span | |
= @episode.description | |
#other_episodes | |
- @episodes.each do |episode| | |
%h3 | |
= "Episódio #{episode.id} - #{episode.title}" | |
%span | |
= episode.description | |
#### The OUTPUT #### | |
<div id="current_episode"> | |
<h3>Episódio 1 - Cache Variable</h3> | |
</div> | |
<div id="other-episodes"> | |
<h3>Episódio 2 - Cache Variable</h3> | |
<span>...</span> | |
<!-- WTF???????? --> | |
<h3>Episódio 2 - Cache Variable</h3> | |
<span>...</span> | |
<!-- WTF???????? --> | |
<h3>Episódio 3 - Cache Variable</h3> | |
<span>...</span> | |
</div> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### HAML AND DATAMAPPER ###### | |
### Assuming that @episodes is: | |
# | |
# [#<Episode @id=1 @title="Cache Variable">, #<Episode @id=2 @title="Cache Variable"> , #<Episode @id=3 @title="Cache Variable">] | |
# | |
#current_episode | |
- unless @episodes.empty? | |
- @episode = @episodes.shift | |
%h3 | |
= "Episódio #{@episode.id} - #{@episode.title}" | |
%span | |
= @episode.description | |
- # INSTEAD ITERATE over a DataMapper collection, just converto to a Ruby Array and it works very well | |
- # | |
- # So Appears this is a bug in the Haml | |
- | |
#other_episodes | |
- @episodes.to_a.each do |episode| | |
%h3 | |
= "Episódio #{episode.id} - #{episode.title}" | |
%span | |
= episode.description | |
#### The OUTPUT #### | |
<div id="current_episode"> | |
<h3>Episódio 1 - Cache Variable</h3> | |
</div> | |
<div id="other-episodes"> | |
<h3>Episódio 2 - Cache Variable</h3> | |
<span>...</span> | |
<h3>Episódio 3 - Cache Variable</h3> | |
<span>...</span> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment