Mastering Redmine

Mastering Redmine is a comprehensive guide with tips, tricks and best practices, and an easy-to-learn structure.

Check the book project on this site and/or

Buy the book

By buying this book you will also be donating to Redmine (see this page).


Bug #1852

Anonymous User is not exists error when the db is empty(loaded the default data)

Added by Riceball LEE over 1 year ago. Updated over 1 year ago.

Status:Closed Start:15 Sep 2011
Priority:Major Due date:20 Oct 2011
Assigned to:Andriy Lesyuk % Done:

100%

Category:-
Target version:0.0.3
System: External issue:
System version:
Votes: 0

Description

[workaround]
  • mv the extened_profile folder to another folder.
  • restart and refresh the redmine page once.
  • mv the extended_profile plugin back.

Associated revisions

Revision 23
Added by Andriy Lesyuk over 1 year ago

Included changes for #1852

History

Updated by Andriy Lesyuk over 1 year ago

  • Status changed from New to Open
  • Assigned to set to Andriy Lesyuk

Did not get. How to reproduce the issue?

Updated by Riceball LEE over 1 year ago

Reproducing Steps

  1. ensure the extened_profile in the vender/plugins dir
  2. remove/empty the database, such as: db/production.sqlte3
  3. rake db:migrate
  4. rake db:load_default_datas
  5. rake db:migrate_plugins
  6. ruby script/server

Updated by Andriy Lesyuk over 1 year ago

How do the plugin behave in this case?.. Gives error?

Updated by Riceball LEE over 1 year 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'

Updated by Riceball LEE over 1 year ago

I got the reason:

The problem is in the ExtendedUserPatch:

validates_presence_of :extended_profile

comment it the anonymous user can be created.

Updated by Riceball LEE over 1 year ago

Change to this to avoid the problem:

1             validates_presence_of :extended_profile, :unless => Proc.new { |user| user.is_a?(AnonymousUser) }

Updated by Andriy Lesyuk over 1 year ago

  • Priority changed from Critical to Major
  • Target version set to 0.0.3

Good find! Thank you!

Updated by Mario Luzeiro over 1 year ago

Its happen same here, any news about it?

Updated by Andriy Lesyuk over 1 year 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?

Updated by Andriy Lesyuk over 1 year ago

  • Status changed from In Progress to Closed

Well... I believe it has been fixed!

Also available in: Atom PDF