Skip to content

Instantly share code, notes, and snippets.

@owendall
Created July 29, 2010 23:40
Show Gist options
  • Select an option

  • Save owendall/499523 to your computer and use it in GitHub Desktop.

Select an option

Save owendall/499523 to your computer and use it in GitHub Desktop.
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