Created
March 24, 2014 22:16
-
-
Save luckyruby/9750482 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
class Reports::Duplicates | |
include ActiveModel::Validations | |
include ActiveModel::Conversion | |
extend ActiveModel::Naming | |
attr_accessor :run_time, :conditions, :matches | |
def initialize(attributes = {}) | |
self.run_time = Time.now | |
attributes.each {|name, value| send("#{name}=", value)} | |
self.conditions = [] | |
self.matches = {} | |
construct_query | |
end | |
def persisted? | |
false | |
end | |
def run(options={}) | |
end | |
private | |
def construct_query | |
end | |
def consolidate_conditions | |
if matches.empty? | |
self.conditions = conditions.join(" AND ") | |
else | |
self.conditions = [conditions.join(" AND ")] << matches | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment