Iterate through activerecords

Hello,

I am a Rails newbie and I have problems to iterate through a list of
records.

pseudo code.

def do something
@userlist = User.find(:all)
@userlist.each {|item| item.calculate_stats item.save}
end

Ther problem is that running this throws an error:
ArgumentError (wrong number of arguments (1 for 0)):

Any ideas what’s goung wrong?

Thanks!
Chris

item.calculate_stats;item.save

or

item.calculate_stats
item.save

Thanks - now it works :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs