lib/rooftop/field_aliases.rb in rooftop-0.0.6 vs lib/rooftop/field_aliases.rb in rooftop-0.0.7.4

- old
+ new

@@ -17,9 +17,15 @@ r.send("#{new}=",r.send(old)) end end }) + base.send(:before_save, ->(r) { + r.field_aliases.each do |old,new| + r.send(:"restore_#{new}!") unless r.new? + end + }) + end module ClassMethods # Call alias_field(foo: :bar) in a class to alias the foo as bar. # @param aliases [Sym] a hash of old and new field names \ No newline at end of file