jackdempsey / sequel_polymorphic

MIT License
37 stars 13 forks source link

About this project and Sequel way #20

Open kuraga opened 7 years ago

kuraga commented 7 years ago

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)
end

And 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)
end

Just feel the difference and incompatibilities...

jackdempsey commented 7 years ago

This isn't really an Issue per se. You have access now to this project and rubygems so feel free to update as you and others see fit!

kuraga commented 5 years ago

And seems like all of these don't work properly, see https://github.com/jackdempsey/sequel_polymorphic/issues/32, https://groups.google.com/forum/#!topic/sequel-talk/Ukb8APwWtWY

kuraga commented 5 years ago

I marked gem unmaintained in https://github.com/jackdempsey/sequel_polymorphic/commit/2bbaa36ccec2f9c13d85973c5b31658ae3532aae