Bug #1852
Anonymous User is not exists error when the db is empty(loaded the default data)
100%
Description
- mv the extened_profile folder to another folder.
- restart and refresh the redmine page once.
- mv the extended_profile plugin back.
Associated revisions
Included changes for #1852
History
#1 Updated by Andriy Lesyuk over 13 years ago
- Status changed from New to Open
- Assignee set to Andriy Lesyuk
Did not get. How to reproduce the issue?
#2 Updated by Riceball LEE over 13 years ago
Reproducing Steps¶
- ensure the extened_profile in the vender/plugins dir
- remove/empty the database, such as: db/production.sqlte3
- rake db:migrate
- rake db:load_default_datas
- rake db:migrate_plugins
- ruby script/server
#3 Updated by Andriy Lesyuk over 13 years ago
How do the plugin behave in this case?.. Gives error?
#4 Updated by Riceball LEE over 13 years ago
Need logout first(if cookie is not clear). then u can get the error:
Processing WelcomeController#index (for 127.0.0.1 at 2011-09-17 13:59:15) [GET] Parameters: {"action"=>"index", "controller"=>"welcome"} SQL (0.2ms) SELECT max("settings".updated_on) AS max_updated_on FROM "settings" Cache read: chiliproject/setting-cleared_on Cache miss: chiliproject/setting/rest_api_enabled ({}) Setting Load (0.2ms) SELECT * FROM "settings" WHERE ("settings"."name" = 'rest_api_enabled') LIMIT 1 Cache write (will save 2.47ms): chiliproject/setting/rest_api_enabled AnonymousUser Load (0.2ms) SELECT * FROM "users" WHERE ( ("users"."type" = 'AnonymousUser' ) ) LIMIT 1 WARNING: Can't mass-assign these protected attributes: login CACHE (0.0ms) SELECT * FROM "users" WHERE ( ("users"."type" = 'AnonymousUser' ) ) LIMIT 1 RuntimeError (Unable to create the anonymous user.): app/models/user.rb:502:in `anonymous' app/models/user.rb:493:in `current' app/controllers/application_controller.rb:106:in `check_if_login_required' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:95:in `start' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `each' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `start' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:23:in `start' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
#5 Updated by Riceball LEE over 13 years ago
I got the reason:
The problem is in the ExtendedUserPatch:
validates_presence_of :extended_profile
comment it the anonymous user can be created.
#6 Updated by Riceball LEE over 13 years ago
Change to this to avoid the problem:
validates_presence_of :extended_profile, :unless => Proc.new { |user| user.is_a?(AnonymousUser) }
#7 Updated by Andriy Lesyuk over 13 years ago
- Priority changed from Critical to Major
- Target version set to 0.0.3
Good find! Thank you!
#8 Updated by Mario Luzeiro about 13 years ago
Its happen same here, any news about it?
#9 Updated by Andriy Lesyuk about 13 years ago
- Due date set to 20 Oct 2011
- Status changed from Open to In Progress
- % Done changed from 0 to 100
Just committed changes suggested by Riceball. Can anyone test and confirm?
#10 Updated by Andriy Lesyuk about 13 years ago
- Status changed from In Progress to Closed
Well... I believe it has been fixed!