Rails - handling global site settings

Posted by egarcia on Stack Overflow See other posts from Stack Overflow or by egarcia
Published on 2010-04-09T12:59:19Z Indexed on 2010/04/09 13:03 UTC
Read the original article Hit count: 309

I'm developing a new rails application which is supposed to be installed several times in order to implement several sites.

There are some things, like the "Site Title" or the "Default Number of Items per Page" that clearly belong to a "global settings" table / config file.

I've made a list of the things I think I'll need:

  • ActiveRecord model that is capable of:
    • Storing different kinds of data. I suppose this would be accomplished encoding the values on a string on the db, probably with a "type" field.
    • Indexing settings by name
    • Validations based on a "type" attribute (i.e. don't accept invalid dates on "date" settings)
    • Validations based on a allows_nil property.
  • A controller that allows me to change settings via views.

I'm pretty sure I could implement this myself, but I'm not willing to reinvent the wheel. I've done some searching, but I could only find rails-settings, which doesn't really serve me: I need a proper model & controller so I can use declarative-authorization, and it does not provide any controller or view facilities.

Is there a gem or plugin out there that implements what I want, or any library I should look at?

Thanks a lot.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about settings