How to fix NameError (undefined local variable or method `background' for #<#<Class) in avatar_helper.rb? Question
+0
−0
I'm setting up a QPixel instance. I just created a new category and I realized in the rails s
output a NameError in avatar_helper.rb:
Started GET "/users/1/avatar/40.png" for 127.0.0.1 at 2022-01-12 22:37:01 +0100
Started GET "/assets/codidact.png" for 127.0.0.1 at 2022-01-12 22:37:01 +0100
Processing by UsersController#avatar as PNG
Parameters: {"id"=>"1", "size"=>"40"}
Host localhost:3000, community #1 (Dev Community)
User Load (4.4ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
CommunityUser Load (5.6ms) SELECT `community_users`.* FROM `community_users` WHERE `community_users`.`user_id` = 1 AND `community_users`.`community_id` = 1 LIMIT 1
User 1 (aaa) signed in
....
NameError (undefined local variable or method `background' for #<#<Class:0x00007f2dad266998>:0x00007f2dacaeec38>):
app/helpers/users/avatar_helper.rb:28:in `block in user_auto_avatar'
config/initializers/namespaced_cache.rb:11:in `block (2 levels) in <class:NamespacedEnvCache>'
app/helpers/users/avatar_helper.rb:23:in `user_auto_avatar'
app/controllers/users_controller.rb:474:in `block (2 levels) in avatar'
app/controllers/users_controller.rb:471:in `avatar'
Processing by ErrorsController#error as PNG
Parameters: {"id"=>"1", "size"=>"40"}
Host localhost:3000, community #1 (Dev Community)
User 1 (aaa) signed in
...
Completed 500 Internal Server Error in 214ms (Views: 126.5ms | ActiveRecord: 25.9ms)
I haven't set an avatar yet and the page output looks okay too (no error message visible, but also no avatar image).
Is it critical? Should I do something?
Tried to fix it and created a PR.
1 answer
+0
−0
It was a minor regression. Fixed in https://github.com/codidact/qpixel/commit/993562804a2843d1e96764ffe6d955f9f333389d
1 comment thread