lib/assets/javascripts/unpoly/classes/record.coffee in unpoly-rails-0.57.0 vs lib/assets/javascripts/unpoly/classes/record.coffee in unpoly-rails-0.60.0
- old
+ new
@@ -6,11 +6,17 @@
throw 'Return an array of property names'
constructor: (options) ->
u.assign(this, @attributes(options))
- attributes: (source = @) =>
+ attributes: (source = @) ->
u.only(source, @fields()...)
- copy: (changes = {}) =>
+ "#{u.copy.key}": ->
+ @variant()
+
+ variant: (changes = {}) ->
attributesWithChanges = u.merge(@attributes(), changes)
new @constructor(attributesWithChanges)
+
+ "#{u.isEqual.key}": (other) ->
+ other && (@constructor == other.constructor) && u.isEqual(@attributes(), other.attributes())