Skip to content

About this project and Sequel way #20

@kuraga

Description

@kuraga

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions