30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/mailee/active_record.rb', line 30
def sync_with_mailee(options = {})
unless syncd? cattr_accessor :sync_options
after_create :create_in_mailee
after_update :update_in_mailee
after_destroy :destroy_in_mailee
self.sync_options = {:email => :email, :name => :name, :news => :news}.merge(options)
unless self.column_names.include?(self.sync_options[:email].to_s)
raise "Campo #{sync_options[:email]} não existe em #{new.class}."
end
unless self.column_names.include?(self.sync_options[:name].to_s)
self.sync_options[:name] = nil
end
unless self.column_names.include?(self.sync_options[:news].to_s)
self.sync_options[:news] = nil
end
end
include InstanceMethods
end
|