Skip to content

Commit

Permalink
Added support for matching across different content models
Browse files Browse the repository at this point in the history
  • Loading branch information
cykod committed Jun 1, 2011
1 parent c207b9b commit 3885154
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions app/models/content_model_type.rb
Expand Up @@ -51,6 +51,22 @@ def self.human_attribute_name(attribute)
attribute.to_s.humanize
end

def match_models(entry)
my_attr = self.attributes
en_attr = entry.attributes

output = {}


my_attr.each do |fld,value|
if !(fld =~ /_id$/) && fld != 'id' && en_attr.has_key?(fld) && en_attr[fld].blank?
output[fld] = value
end
end
output

end


def self.identifier_field; nil; end

Expand Down

0 comments on commit 3885154

Please sign in to comment.