Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- readings=Reading.where("user_id=? and time between ? and ?", user_id, start_of_day, end_of_day)
- puts "ids: " + readings.map(&:id).to_s
- sum=0
- sum = readings.inject({}) do |total, element|
- total = element.value
- total
- end
- puts "here is the sum: #{sum}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement