I'm looking for a part-time remote job.

Hire me


I'm the author of:

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

Check the book's project or

Buy the book

Social pages of the book:

By buying this book you also donate to Redmine (see this page).


Follow me:

Bug #1852

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

Added by Riceball LEE about 13 years ago. Updated about 13 years ago.

Status:
Closed
Priority:
Major
Assignee:
Target version:
Start date:
15 Sep 2011
Due date:
20 Oct 2011
% Done:

100%

Redmine version:
External issue:

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 (diff)
Added by Andriy Lesyuk about 13 years ago

Included changes for #1852

History

#1 Updated by Andriy Lesyuk about 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 about 13 years 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

#3 Updated by Andriy Lesyuk about 13 years ago

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

#4 Updated by Riceball LEE about 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 about 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 about 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 about 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!

Also available in: Atom PDF

Terms of use | Privacy policy