Created
November 2, 2009 04:01
-
-
Save arnab/223925 to your computer and use it in GitHub Desktop.
If you want to load data from 2 tables (with a belongs_to/has_many relation)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
metrics_with_inputs = Revision.find( | |
:all, | |
:conditions => { :id => self.revisions.map { |r| r.id } }, | |
:select => 'revisions.metric, revisions.snap_date, revisions.updated_at, | |
inputs.author, inputs.as_of_date, inputs.units', | |
:joins => 'join inputs on inputs.revision_id = revisions.id', | |
:order => 'revisions.metric, revisions.snap_date, revisions.updated_at' | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment