Post History
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-...
      #3: Post edited
      
      
  
  
    
    
  
  
  
    
    
  
    
        - 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?
- 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](https://github.com/codidact/qpixel/pull/758).
      #2: Post edited
      
      
  
  
    
    
  
  
  
    
    
  
    
        - 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 fine to (no error message visible).
- Is it critical? Should I do something?
- 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?
      #1: Initial revision
      
      
  
  
    
    
  
  
  
    
    
  
    
        How to fix NameError (undefined local variable or method `background' for #<#<Class) in avatar_helper.rb?
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 fine to (no error message visible).
Is it critical? Should I do something?
        
 
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
            