Closed romeerez closed 5 years ago
Hello and thanks for this very useful gem! Could you please replace here https://github.com/EugZol/where_exists/blob/master/lib/where_exists.rb#L158
join_table = [self.table_name, associated_model.table_name].sort.join("_")
to
join_table = association.join_table
because it doesn't works properly for models with modules such
class ModuleName::ModelName has_and_belong_to_many :other_model_in_this_module end
Also this:
associated_join_ids = quote_table_and_column_name(join_table, "#{associated_model.name.downcase}_id")
to this: associated_join_ids = quote_table_and_column_name(join_table, association.association_foreign_key)
associated_join_ids = quote_table_and_column_name(join_table, association.association_foreign_key)
Please check version ~> 1.2 – PR by @SampsonCrowley seems to have fixed that? Please feel free to reopen otherwise.
~> 1.2
Hello and thanks for this very useful gem! Could you please replace here https://github.com/EugZol/where_exists/blob/master/lib/where_exists.rb#L158
join_table = [self.table_name, associated_model.table_name].sort.join("_")
to
join_table = association.join_table
because it doesn't works properly for models with modules such
Also this:
associated_join_ids = quote_table_and_column_name(join_table, "#{associated_model.name.downcase}_id")
to this:
associated_join_ids = quote_table_and_column_name(join_table, association.association_foreign_key)