Skip to content

Instantly share code, notes, and snippets.

@mark
Created February 1, 2011 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mark/806432 to your computer and use it in GitHub Desktop.
Save mark/806432 to your computer and use it in GitHub Desktop.
application_model.rb
#######
# #
# ids #
# #
#######
public
def self.ids(query_options = {})
values(query_options).map &:to_i
end
def self.values(query_options = {})
sql = self.send(:construct_finder_sql, { :select => "#{table_name}.id" }.merge( query_options ))
self.connection.select_values(sql)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment