lib/sequel/plugins/pg_array_associations.rb in sequel-4.14.0 vs lib/sequel/plugins/pg_array_associations.rb in sequel-4.15.0

- old
+ new

@@ -238,11 +238,11 @@ cached_fetch(:predicate_key){qualify_assoc(primary_key)} end # The primary key of the associated model. def primary_key - cached_fetch(:primary_key){associated_class.primary_key} + cached_fetch(:primary_key){associated_class.primary_key || raise(Error, "no primary key specified for #{associated_class.inspect}")} end # The method to call to get value of the primary key of the associated model. def primary_key_method cached_fetch(:primary_key_method){primary_key} @@ -299,9 +299,10 @@ # Setup the many_to_pg_array-specific datasets, eager loaders, and modification methods. def def_many_to_pg_array(opts) name = opts[:name] model = self pk = opts[:eager_loader_key] = opts[:primary_key] ||= model.primary_key + raise(Error, "no primary key specified for #{inspect}") unless pk opts[:key] = opts.default_key unless opts.has_key?(:key) key = opts[:key] key_column = opts[:key_column] ||= opts[:key] opts[:after_load].unshift(:array_uniq!) if opts[:uniq] opts[:dataset] ||= lambda do