slim_scrooge icon indicating copy to clipboard operation
slim_scrooge copied to clipboard

not compatible with rails 3.1rc4

Open gillesmathurin opened this issue 13 years ago • 19 comments

Hi, unfortunately it doesn't work with rails 3.1rc4 (at leat on my app) - using rvm and ruby 1.9.2p-180

gillesmathurin avatar Jun 30 '11 18:06 gillesmathurin

By "it doesn't work", do you mean that slim_scrooge fails to install, fails to intercept queries, or throws an error?

I'm a contributor, not the author, but I'm sure more detailed information would be welcome.

I would note, however, that when I upgraded an app which used slim_scrooge to Rails 3.0, I found the overall performance was slightly better without slim_scrooge, so if you're considering slim_scrooge as an optimization for your Rails 3.1 app, it may or may be your best option.

-Steve

purcell avatar Jun 30 '11 18:06 purcell

Steve: yes - I think because Rails 3 is already lazy about sending queries to the DB, slim scrooge may or may not help depending on your app.

Gilles: yes, more info on what happens would be helpful.

sdsykes avatar Jun 30 '11 19:06 sdsykes

Hi, well you are right, by doesn't work i mean it prevents queries to be made. Simple test, create an app with rails 3.1rc4 , add a simple model (like Post) add an index action Post.all and see the app throwing an error while accessing the index page , the same happens in the rails console …

i may have miss something though (not as smart) as you guys

gillesmathurin avatar Jun 30 '11 19:06 gillesmathurin

I can confirm the issue, I had a 3.0.9 app that I upgraded to 3.1.1, a simple User.find stopped working => ( I had logged the following issue on rails https://github.com/rails/rails/issues/3452).

As soon a I removed reference to slims_scrooge and updated my bundle, it worked.

Windows 7 Ruby 1.8.7 (patch 352) Rails 3.1.1

algritz avatar Oct 27 '11 17:10 algritz

I'll have time to investigate, but it'll be in a couple of days. In the mean time, pull requests are welcome...

sdsykes avatar Oct 30 '11 08:10 sdsykes

I'm in no rush, as my app suffer other issues elsewhere anyway. (I can't pre-compile assests)

algritz avatar Oct 30 '11 12:10 algritz

hello! I am having the same issue ... from what i have seen .... my problem resides somewhere in :

lib / slim_scrooge / slim_scrooge.rb line #13

and i think that is because it is not compatible with arel:

here is my stack trace: https://gist.github.com/1360276

alecslupu avatar Nov 12 '11 09:11 alecslupu

Hi, I'm having the same issue, btw the log dont return an specific location for the error file or line number.

wrong number of arguments (2 for 1) (removing the gem, the app works well)

Ubuntu 11.10 Ruby 1.9.2 Rails 3.1.0

andreydjason avatar Nov 17 '11 17:11 andreydjason

I'm sorry I haven't had time to look at this. Thanks for the reports, this weekend should provide me an opportunity.

sdsykes avatar Nov 17 '11 21:11 sdsykes

Thie issue is that the internal API has changed here, and we are now getting an Arel object instead of the SQL.

In fact this could be beneficial, because we can manipulate the query better while it is in Arel, but it's going to take a little while to figure out and test.

sdsykes avatar Nov 25 '11 20:11 sdsykes

Yeah ... is there any way i could help you ?
i am rails noob, but maybe i could help you with something ...

alecslupu avatar Nov 25 '11 21:11 alecslupu

Now I have a modified version that is partially working, more testing to do though.

If you can find out the best way to modify an ARel SelectManager object to vary the select columns, that would certainly be of use, because at the moment I am delving inside it, which is not ideal.

sdsykes avatar Nov 26 '11 14:11 sdsykes

This issue is not yet resolved on Rails 3.2. Its breaking on User.find

bhushangahire avatar Feb 22 '12 13:02 bhushangahire

Hi.. i am facing the same problem with slim_scrooge.

I added gem slim_scrooge to my gemfile and bundle installed and run the server. It gives me an error in the line which just do a simple User.find .... Also when i uncomment the slim_scrooge from the gemfile and restart it works....

May i know what is the problem and also if you can provide me any other alternative gem to this?

Thanks

aarthiraj561 avatar Apr 20 '12 06:04 aarthiraj561

Is there any progress on this?

I've had a quick look and have (potentially) a fix that works with Rails 3.1.3

It looks like binds=[] should be passed as a parameter to find_by_sql_with_slim_scrooge

def find_by_sql_with_slim_scrooge(sql, binds = [])

and then passing it on to

rows = connection.select_all(sql, "#{name} Load SlimScrooged 1st time", binds)

Can anyone clarify?

jimmckerchar avatar Oct 09 '12 15:10 jimmckerchar

Are you using the latest version in this repo?

See here https://github.com/sdsykes/slim_scrooge/commit/6d1645f0138fec7030a8f404ba9b4df24b8ee3d2

sdsykes avatar Oct 09 '12 18:10 sdsykes

@sdsykes It would appear not. Thanks

jimmckerchar avatar Oct 10 '12 07:10 jimmckerchar

BTW, I just tried using v 1.0.13 against a PostgreSQL db. It crashes like this "PG::Error: ERROR: column "1" does not exist LINE 1: ...erride_fb_pic","users"."id" FROM "users" WHERE "id" IN ("1")" That "1" is an integer and shouldn't have quotes around it.

MSeneadza avatar Jan 11 '13 17:01 MSeneadza

All, I've submitted a pull request for this issue. Seems in a postgresql context the quote_column_name was causing the arguments to be quoted instead of verbatim. This is my first pull to this repository; so let me know if I missed something as I wasn't able to run the specs because of setup issues. Was getting the 'test/helper' doesn't exist which implies this was being dev'd under an older version of ruby (I'm on 1.9.3). Thanks!

bradphilips avatar Apr 11 '13 02:04 bradphilips