Code Monkey home page Code Monkey logo

Comments (2)

nekogami avatar nekogami commented on August 20, 2024

Not sure if it is related but,
somehow I cannot execute my query by doing

ActiveRecord::Base.connection.execute(method_generating_arel_object_request)

when in my projection I have .average.as("somename") because the following error is raised

TypeError: no implicit conversion of Arel::SelectManager into String
from /Users/{users}/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:97:in `async_exec'

so I ended up doing

ActiveRecord::Base.connection.execute(method_generating_arel_object_request.to_sql)

from arel.

tenderlove avatar tenderlove commented on August 20, 2024

This doesn't sound a like a problem with ARel, but a problem with the database adapter or possibly your column types. The database adapter uses the column type to cast it to a Ruby object. It could be that the column type is wrong, or that the database adapter doesn't know how to handle that type. Take a look at the pg_typeof function. You can use that function to figure out what type you're selecting. From there, either fix your data so it's the right type, or file a bug on the Rails side (as it's a bug in the adapter).

Thanks!

from arel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.