Skip to content

Instantly share code, notes, and snippets.

@scott2619
Last active August 29, 2015 14:17
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 scott2619/76c66de44427e503aabf to your computer and use it in GitHub Desktop.
Save scott2619/76c66de44427e503aabf to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'active_record'
require 'yaml'
dbconfig = YAML::load(File.open('config/database.yml'))
ActiveRecord::Base.establish_connection(dbconfig)
class Matrixgroup < ActiveRecord::Base
def self.images
brands.each do |brand|
where(brand: brand).pluck(:imageRef4)
end
end
private
def brands
pluck(:brand).uniq
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment