Frederick Cheung wrote:
> On Dec 29, 2:21�pm, LeonS <[email protected]> wrote:
>> Hi,
>> i despair in case of an array.
>> I'll take some data into an array, but when i iterate the array some
>> elements of the array seems to be missed, but the missing element are
>> displayed in the view.
>> I'm using the Plugin Rails_Authorization.
>>
> 
> You're deleting from the array as you are iterating over it - don't do
> that.

Yep. A common mistake when iterating arrays. One solution is to build a 
new array containing the objects you want, rather than deleting objects 
that you don't want. There may be better approaches that might use less 
memory though.
-- 
Posted via http://www.ruby-forum.com/.

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to