使用 Redmine 提供的插件设置存储布尔值

Storing a boolean with Redmine provided plugin settings

我正在为 Redmine 项目管理系统开发一个插件。要配置插件,我使用框架提供的部分设置。我需要存储一个应使用复选框设置和取消设置的布尔值。

同时

<input  type="text" id="settings_mytext"
            value="<%= settings['mytext'] %>"
            name="settings[mytext]"
>

适用于字符串和数值,以下不适用于布尔值或任何值。

<input  type="checkbox" id="settings_myboolean"
            checked="<%= settings['myboolean'] %>"
            value="<%= settings['myboolean'] %>"
            name="settings[myboolean]"
>

那么有人知道如何使用 Redmine 提供的插件设置页面来存储复选框的选中状态吗?

感谢您的帮助。

试试这个 way:

<p>
  <label>Oauth authentification:</label>
  <%= check_box_tag "settings[oauth_authentification]", true, @settings[:oauth_authentification] %>
</p>