No type definition on plugins' settings type
Antonio Terceiro
terceiro at colivre.coop.br
Wed Oct 30 15:26:44 BRST 2013
On Wed, Oct 30, 2013 at 12:01:51PM -0300, Bráulio Bhavamitra wrote:
> Hello all,
>
> Noosfero::Plugin::Settings doesn't allow type definition. This is a huge
> problem: imagine that you use a form and have a check box (boolean type).
> The boolean type will not type cast from the string "false" to false, and
> when the variable is checked it will be considered true, as if "false" is
> considered true!
>
> Any suggestion on how to fix that?
using act_as_having_settings on top of that?
e.g. (untested)
class MyPlugin < Noosfero::Plugin
def settings
@settings ||= Noosfero::Plugin::Settings.new(profile, self)
end
acts_as_having_settings
settings_items :my_checkbox, :type => :boolean
end
maybe this could even be streamlined to avoid plugins having to
duplicate this pattern
--
Antonio Terceiro <terceiro at colivre.coop.br>
Colivre - Cooperativa de Tecnologias Livres
http://www.colivre.coop.br/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20131030/d0277da4/attachment.pgp>
More information about the Noosfero-dev
mailing list