1
votes

I am currently developing an application using NuoDB and Ruby on Rails

I am using the 'nuodb' gem and the 'activerecord-nuodb-adapter' to connect to the DB but I seem to be getting an error with the logs when executing commands.

For example, when I run the commands in my action:

x = GeneralLedger.where("id = ?", params[:id]).first
x.delete

This would output in the development logs:

[1m[35mGeneralLedger Load (2.4ms)[0m SELECT `general_ledgers`.* FROM `general_ledgers` WHERE (id = '48') FETCH FIRST 1 ROWS ONLY

[1m[35mSQL (0.3ms)[0m DELETE FROM `general_ledgers` WHERE `general_ledgers`.`id` = 48

This is okay, but when I execute the more direct approach which is:

GeneralLedger.find(params[:id]).delete

I keep get this error:

Could not log "sql.active_record" event. NoMethodError: undefined method `name' for 48:Fixnum   <------ error

[1m[35mSQL (0.4ms)[0m DELETE FROM `general_ledgers` WHERE `general_ledgers`.`id` = 48

Here's another example of the log error I get when I am updating existing records:

Could not log "sql.active_record" event. NoMethodError: undefined method `name' for 21:Fixnum
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
[1m[35m (0.4ms)[0m UPDATE `general_ledgers` SET `accnt_dscr` = 'Other Expenses', `updated_at` = '2014-03-03 14:10:26' WHERE `general_ledgers`.`id` = 21
[1m[36m (0.3ms)[0m [1mcommit transaction[0m

Although the sql commands are executed and the records are deleted, I am unable to get the SQL commands generated.

I've tried using sqlite3 for testing and the

Could not log "sql.active_record" event.

error doesn't show up.

I've been trying to figure out where this logging error is coming from and I can't locate it. I'm not sure if I would just leave it alone since the commands are still executed.

1

1 Answers

0
votes

This is a known issue with the driver that this being tracked here; GitHub: GeneralLedger.find(params[:id]).delete throws error while logging the delete in ActiveRecord

To your point the Error is not preventing the action from being performed, it's just the output to the logs that is being omitted.

I'd expect further updates to be posted to the GitHub link above.