Created
May 29, 2014 17:34
-
-
Save pjanik/5df9e9668ce4e1bb8f4a to your computer and use it in GitHub Desktop.
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
names_in_old_order = sequence_with_activities.activities.map { |a| a.name } | |
sequence_with_activities.activities[0].name.should == names_in_old_order[0] | |
sequence_with_activities.activities[1].name.should == names_in_old_order[1] | |
sequence_with_activities.activities[2].name.should == names_in_old_order[2] | |
sequence_with_activities.lightweight_activities_sequences[0].update_attributes!(position: 1) | |
sequence_with_activities.lightweight_activities_sequences[1].update_attributes!(position: 0) | |
sequence_with_activities.lightweight_activities_sequences[2].update_attributes!(position: 2) | |
sequence_with_activities.reload # sequence_with_activities.activities.reset | |
names_in_new_order = sequence_with_activities.activities.map { |a| a.name } | |
names_in_new_order[1].should == names_in_old_order[0] | |
names_in_new_order[0].should == names_in_old_order[1] | |
names_in_new_order[2].should == names_in_old_order[2] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment