Rails 4 AR `from` different than rails 3?

Dane O'Connor

In rails 3 if I write: Model.from('models') arel generates the following sql:

select "models".* from models

In rails 4 the same arel generates the following sql:

select "models".* from 'models', NULL

The table name is wrapped in quotes and ', NULL' is appended. How do I use arel to give me the same results as in rails 3?

I was leveraging the original behavior so I could run a fairly complex with recursive query against postgres. In rails4, postgres is choking when it gets to the single quote preceding value I give from.

Is there a better way to do a with recursive query? Or, is there a way to query with arel so it works as before?

Dane O'Connor

This appears to be an incompatibility with the squeel gem (the master branch as of today).

EDIT I've sent a pull request to squeel's master branch. Fixes the issue for me.

EDIT 2: Merged into master

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Virtual attributes in Rails 4 from Rails 3

From Dev

Lost automatic ActiveRecord caching by migrating from Rails 3 to Rails 4

From Dev

Rails 4 Method Not Allowed after Upgrading from Rails 3

From Dev

Lost automatic ActiveRecord caching by migrating from Rails 3 to Rails 4

From Dev

Rails scope when upgrading from 3 to 4

From Dev

Rails 4 to 5 AR boolean deprecation

From Dev

Modal (boot-strap) in rails 4 not working now since upgrading from rails 3 to rails 4

From Dev

rails 4 can't start server after upgrading to rails 4 from rails 3

From Dev

Rails 4 + ActiveRecord: group_by on column from different model

From Dev

Render a different view from any controller in Rails 4

From Dev

Rails 4 - Displaying values from different model in a view

From Dev

Rails 4 + Solr: Show search result from different model

From Dev

Save data in table from different controller/view in Rails 4

From Dev

rails 3.2 / activerecord - how to display 30 values from AR in a table with 3 columns?

From Dev

rails 3.2 / activerecord - how to display 30 values from AR in a table with 3 columns?

From Dev

Rails timestamp different than mysql timestamp

From Dev

Rails 3 to Rails 4 - superclass mismatch

From Dev

Using different assets for a different namespace in Rails 4

From Dev

Upgrade from Rails 3.2 to Rails 4

From Dev

Rails 4 + Capistrano 3 - Deploy to Production Server from Local Repo

From Dev

Bootstrap 3, Haml, and Rails 4 - Create dropdown from model attributes

From Dev

Download file from S3 to Rails 4 app

From Dev

Bootstrap 3, Haml, and Rails 4 - Create dropdown from model attributes

From Dev

Rails 4 / Bootstrap 3: how to display a different navigation bar on different pages?

From Dev

Using Roadie 3 With Rails 4

From Dev

Wrong order on has_many association when upgrading from rails 3 to rails 4

From Dev

Scrot command from rails 4

From Dev

Signout from a controller in rails 4

From Dev

Bootstrap search from rails 4

Related Related

  1. 1

    Virtual attributes in Rails 4 from Rails 3

  2. 2

    Lost automatic ActiveRecord caching by migrating from Rails 3 to Rails 4

  3. 3

    Rails 4 Method Not Allowed after Upgrading from Rails 3

  4. 4

    Lost automatic ActiveRecord caching by migrating from Rails 3 to Rails 4

  5. 5

    Rails scope when upgrading from 3 to 4

  6. 6

    Rails 4 to 5 AR boolean deprecation

  7. 7

    Modal (boot-strap) in rails 4 not working now since upgrading from rails 3 to rails 4

  8. 8

    rails 4 can't start server after upgrading to rails 4 from rails 3

  9. 9

    Rails 4 + ActiveRecord: group_by on column from different model

  10. 10

    Render a different view from any controller in Rails 4

  11. 11

    Rails 4 - Displaying values from different model in a view

  12. 12

    Rails 4 + Solr: Show search result from different model

  13. 13

    Save data in table from different controller/view in Rails 4

  14. 14

    rails 3.2 / activerecord - how to display 30 values from AR in a table with 3 columns?

  15. 15

    rails 3.2 / activerecord - how to display 30 values from AR in a table with 3 columns?

  16. 16

    Rails timestamp different than mysql timestamp

  17. 17

    Rails 3 to Rails 4 - superclass mismatch

  18. 18

    Using different assets for a different namespace in Rails 4

  19. 19

    Upgrade from Rails 3.2 to Rails 4

  20. 20

    Rails 4 + Capistrano 3 - Deploy to Production Server from Local Repo

  21. 21

    Bootstrap 3, Haml, and Rails 4 - Create dropdown from model attributes

  22. 22

    Download file from S3 to Rails 4 app

  23. 23

    Bootstrap 3, Haml, and Rails 4 - Create dropdown from model attributes

  24. 24

    Rails 4 / Bootstrap 3: how to display a different navigation bar on different pages?

  25. 25

    Using Roadie 3 With Rails 4

  26. 26

    Wrong order on has_many association when upgrading from rails 3 to rails 4

  27. 27

    Scrot command from rails 4

  28. 28

    Signout from a controller in rails 4

  29. 29

    Bootstrap search from rails 4

HotTag

Archive