-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
P.S. Now I see that our project isn't so brilliant... It violates Sequel way...
Just for instance. See here:
collection_singular = singularize(collection_name.to_s).to_sym
collection_singular_id = :"#{collection_singular}_id"
through_klass = constantize(singularize(camelize(through.to_s)))
<...>
:adder => proc do |many_of_instance|
through_klass.create(collection_singular_id => many_of_instance.pk, able_id => pk, able_type => self.class.to_s)
endAnd in Sequel:
lcks = opts[:left_keys] = Array(left)
lcpks = opts[:left_primary_keys] = Array(left_pk)
def _join_table_dataset(opts)
ds = model.db.from(opts.join_table_source)
opts[:join_table_block] ? opts[:join_table_block].call(ds) : ds
end
<...>
opts[:adder] ||= proc do |o|
h = {}
lcks.zip(lcpks).each{|k, pk| h[k] = get_column_value(pk)}
rcks.zip(opts.right_primary_key_methods).each{|k, pk| h[k] = o.get_column_value(pk)}
_join_table_dataset(opts).insert(h)
endJust feel the difference and incompatibilities...
Metadata
Metadata
Assignees
Labels
No labels