lib/pupper/model.rb in pupper-0.2.1 vs lib/pupper/model.rb in pupper-0.2.2
- old
+ new
@@ -17,16 +17,16 @@
include Pupper::ApiAssociations
delegate :backend, to: :class
def initialize(**args)
- args.slice!(*self.class._attributes)
-
assocs, attrs = args.partition do |attr, value|
attr.to_s =~ /_u?id$/ || value.is_a?(Hash) || value.is_a?(Array)
end.map(&Hash.method(:[]))
assocs = build_associations(assocs)
+
+ [attrs, assocs].map { |args| args.slice!(*self.class._attributes) }
super(**attrs, **assocs)
changes_applied