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