Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- finder_class = class_hierarchy.detect { |klass| !klass.abstract_class? }
- results = connection.select_all(
- construct_finder_sql(
- :select => "#{finder_class.quoted_table_name}.#{attr_name}",
- :from => "#{finder_class.quoted_table_name}",
- :conditions => [condition_sql, *condition_params]
- )
- )
- unless results.length.zero?
- found = true
- if configuration[:case_sensitive] && finder_class.columns_hash[attr_name.to_s].text?
- found = c.any? { |a| a[attr_name.to_s] == value }
- end
- record.errors.add(attr_name, configuration[:message]) if found
- end
Add Comment
Please, Sign In to add comment