Simple site-wide configuration in Rails

Posted by Brian in Products, Rails (October 25th, 2007)

After about three months of testing, I’m releasing the Rails Config Model gem. It’s been available on RubyForge for some time but I’ve never advertised it.

The generator will create a configuration table and a form for a system admin to modify system settings for an app. Here’s an example:

ruby script/generate rails_config_model setup logo_url:string welcome_message:text contact_email:string

That will generate a Setup model and a setup_controller complete with unit and functional tests. Developers can use this like so:

@setup = Setup.load

Then display the welcome message on the homepage

<%=@setup.welcome_message %>

You can read more at http://rconfig.rubyforge.org/

Comments are closed.

Sorry, the comment form is closed at this time.