Project

General

Profile

Actions

Defect #7104

open

Accessing core Setting.* values in a plugin's init causes the plugin's settings to not load

Added by Robert Chady over 13 years ago. Updated over 13 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Plugin API
Target version:
-
Start date:
2010-12-13
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

If you access a core value from Setting, such as host_name from a plugin's init.rb, then the plugin's settings will not be properly loaded.

To reproduce, create a simple plugin that does something like:

myurl = Setting.host_name

and then add in some settings

settings :default => {
'myvar' => 'myval'
}, :partial => 'settings/mysettings'

And then try to access the configure page from Administration / Plugins. You can also go in to the console and try to access Setting.plugin_#{your_plugin_name} here -- you will see it is not available. Meanwhile, all aspects of your plugin work fine, other than the settings and anything that tries to reference the settings.

Actions #1

Updated by Jean-Baptiste Barth over 13 years ago

  • Assignee deleted (Jean-Philippe Lang)
  • Priority changed from High to Normal

Somehow discussed in the forum: http://www.redmine.org/boards/3/topics/16587. I ended up not accessing Setting directly in my init.rb (commit)

I admit it's annoying but don't think it's "high" priority since core functionalities are not concerned.

Plus accessing "Setting" values in init.rb may not be a good idea if you want to put your plugin in a fresh redmine install (db:migrate would fail as the table is empty IIRC).

Actions

Also available in: Atom PDF