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

Error in Rails 4.2 #5

Closed
michaelkeenan opened this issue Jan 7, 2017 · 4 comments
Closed

Error in Rails 4.2 #5

michaelkeenan opened this issue Jan 7, 2017 · 4 comments

Comments

@michaelkeenan
Copy link

It looks like this is designed for Rails 5 - maybe add that to the README under Require?

When I run it on a Rails 4.2, e.g.:

Album.where(id: 1)

It shows an error, the beginning of which is:

Could not log "sql.active_record" event. ArgumentError: wrong number of arguments (1 for 2)
["/Users/michaelkeenan/.rvm/gems/ruby-2.2.3@maenad/gems/activerecord-4.2.7/lib/active_record/log_subscriber.rb:23:in `render_bind'"
"/Users/michaelkeenan/.rvm/gems/ruby-2.2.3@maenad/gems/pp_sql-0.2.0/lib/pp_sql.rb:41:in `block in sql'"

Checking the difference between the Rails 5 version of render_bind and the Rails 4.2 version, I see that there's two arguments in Rails 4.2, and one argument in 5. So (though I haven't tested it specifically), that'll be why this is occurring.

Similarly, when I try:

Album.all

I get this error:

Could not log "sql.active_record" event. NoMethodError: undefined method `colorize_payload_name' for #<ActiveRecord::LogSubscriber:0x007fccef1f2e08>
["/Users/michaelkeenan/.rvm/gems/ruby-2.2.3@maenad/gems/pp_sql-0.2.0/lib/pp_sql.rb:44:in `sql'"

colorize_payload_name is a private method in the Rails 5 log_subscriber, but doesn't exist in 4.2.

@kvokka
Copy link
Owner

kvokka commented Jan 8, 2017

Thank you for so full description!

I've just made fixup for Rails 4.2, so, you may try out gem version 0.2.2

Enjoy!

@kvokka kvokka closed this as completed Jan 8, 2017
@redtachyons
Copy link

I tried 0.2.5 and it is not compatible with rails 4.2.8, I had to monkey patch it get it working. *args hack in the code didn't worked for me

@gerrywastaken
Copy link

@kvokka I have a colleague who is running into this issue on rails 5.1. Any chance you remember the commit where the fix was made?

@gerrywastaken
Copy link

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

4 participants