Hi all.

Could you please recommend elegant way (read - best practices in
"Rails way", less DB calls) to solve the following situation ?

I have 2 tables:

Meter
- has_many :meter_records

MeterRecord
- belong_to :meter

I have to calculate difference between meter's current month record
and same meter's previous month record.

I would like to avoid unnecessary selects from DB and also avoid
dealing with SQL - I prefer functionality provided by ActiveRecord.

Can you please recommend the solution or at least point me to a good
tutorial ?

Thank you in advance.

Artūras

-- 
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to