Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with Rails 6.1 #17

Open
Jose4gg opened this issue Mar 17, 2022 · 0 comments
Open

Incompatibility with Rails 6.1 #17

Jose4gg opened this issue Mar 17, 2022 · 0 comments

Comments

@Jose4gg
Copy link

Jose4gg commented Mar 17, 2022

The definition for the where method in Rails 6.1 is the next one

   def where(*args)
      if args.empty?
        WhereChain.new(spawn)
      elsif args.length == 1 && args.first.blank?
        self
      else
        spawn.where!(*args)
      end
    end

    def where!(opts, *rest) # :nodoc:
      self.where_clause += build_where_clause(opts, rest)
      self
    end

The definition for this library is the next one:

 def where(opts = :chain, *rest)
        if opts.is_a?(Hash)
          query = spawn
          translated_attrs = translated_attributes(opts)
          untranslated_attrs = untranslated_attributes(opts)

          unless untranslated_attrs.empty?
            query.where!(untranslated_attrs, *rest)
          end

          translated_attrs.each do |key, value|
            if value.is_a?(String)
              query.where!(":value = any(avals(#{key}))", value: value)
            else
              super
            end
          end

          query
        else
          super
        end
      end

We need to find a way to fix this incompatibility in terms of parameters to make it work in Rails 6.1 and next.

@openscript openscript changed the title [ Incompatibility with Rails 6.1 ] Incompatibility with Rails 6.1 Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant