Advertisement
Guest User

Untitled

a guest
May 4th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. readings=Reading.where("user_id=? and time between ? and ?", user_id, start_of_day, end_of_day)
  2. puts "ids: " + readings.map(&:id).to_s
  3. sum=0
  4. sum = readings.inject({}) do |total, element|
  5. total = element.value
  6. total
  7. end
  8. puts "here is the sum: #{sum}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement