Guest User

Untitled

a guest
Apr 25th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. elsif(oas[obj_attr].attr_type == "reference")
  2. item[obj_attr] = oas[obj_attr].ref_class.constantize.find_or_create(oas[obj_attr].ref_attr, row[index].to_s)
  3. end
  4.  
  5. def find_or_create(attribute, value, user)
  6. c = Country.find(:first, :conditions => attribute + "='" + value + "'")
  7. c = Country.create(attribute.to_sym => value, :created_by => user, :updated_by => user, :owner => user) unless c
  8. return c
  9. end
Add Comment
Please, Sign In to add comment