sdsykes / slim_scrooge

SlimScrooge heavily optimises your database interactions
313 stars 25 forks source link

not compatible with rails 3.1rc4 #17

Open gillesmathurin opened 13 years ago

gillesmathurin commented 13 years ago

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

purcell commented 13 years ago

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

sdsykes commented 13 years ago

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.

gillesmathurin commented 13 years ago

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

algritz commented 13 years ago

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

sdsykes commented 13 years ago

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

algritz commented 13 years ago

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

alecslupu commented 12 years ago

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

andreydjason commented 12 years ago

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

sdsykes commented 12 years ago

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

sdsykes commented 12 years ago

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.

alecslupu commented 12 years ago

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

sdsykes commented 12 years ago

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.

bhushangahire commented 12 years ago

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

aarthiraj561 commented 12 years ago

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

jimmckerchar commented 12 years ago

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?

sdsykes commented 12 years ago

Are you using the latest version in this repo?

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

jimmckerchar commented 12 years ago

@sdsykes It would appear not. Thanks

MSeneadza commented 11 years ago

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.

bradphilips commented 11 years ago

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!