Displaying 1 result from an estimated 1 matches for "my_ts".
Did you mean:
my_s
2008 Jun 17
3
rindex not working with objects from db model
I''m sorting a separate list that doesn''t contain a certain user''s
attribute, but trying to but that certain user''s attribute on the
separate percentile.
test_scores = Testscore.find(:all, :conditions=> {...})
my_testscore = current_user.test_score
my_ts = Testscore.new(:score => my_testscore)
test_scores.push(ts)
sorted_ts = test_scores.sort {|x,y| x.score <=> y.score }
index_one = sorted_ts.index(my_ts)
# why doesn''t this work?
index_two = sorted_ts.rindex(my_ts)
It finds index_one correctly, but index_two always equals inde...