FIX: editing a poll/post with a poll wasn't working properly

This commit is contained in:
Régis Hanol
2015-04-26 00:12:19 +02:00
parent 84c65aeb60
commit 151dea4088
4 changed files with 70 additions and 46 deletions

View File

@ -78,12 +78,12 @@ class Plugin::Instance
end
# Add validation method but check that the plugin is enabled
def validate(klass, attr, &block)
def validate(klass, name, &block)
klass = klass.to_s.classify.constantize
klass.send(:define_method, attr, &block)
klass.send(:define_method, name, &block)
plugin = self
klass.validate(attr, if: -> { plugin.enabled? })
klass.validate(name, if: -> { plugin.enabled? })
end
# will make sure all the assets this plugin needs are registered