Created
July 29, 2010 23:40
-
-
Save owendall/499523 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| def load(id) | |
| options_for_find | |
| @clazz.first( | |
| :conditions => { @clazz.primary_key => id.to_i} | |
| ) | |
| end | |
| def load_all(ids) | |
| options_for_find | |
| @clazz.all( | |
| :conditions => { @clazz.primary_key => ids.map { |id|id.to_i }} | |
| ) | |
| end | |
| private | |
| def options_for_find | |
| options[:include] = @include unless @include.blank? | |
| options[:select] = @select unless @select.blank? | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment