ruby on rails - Appropriate way to handle settings in Rails3 Plugin? -
I am working on a plug-in for Rails3. I want to allow users to override some settings At the moment I am doing this in my plugin rails: like the engine class:
config.my_setting =: default_value until config.respond_to? : My_setting
It looks like a wrong way to handle this. Does a better way or conference use the most plugins in Railway 3?
I recommend that people rename a new setting for their settings in their salon:
Module MyPlugin class Railtie & lt; Rail :: railtig.config.name/plugin = activivport :: ordained hash.new config.my_plugin.dom_default = trueconfig.mail_plugin. Soma_or_default = false initiator "my_plugin.initialize" do | App | App.config.my_plugin #Settings, the user has finally advanced from the end end
After that, users can set the configuration of their plugins or default in their application class override . This uses the tracks in our railway raillet.
As Paul said, you can make it even easier by creating a generator that dumps the initiator with all possible config settings that can be commented for its use.
Comments
Post a Comment