Ask A Question


You’re not receiving notifications from this thread.

What's the best way to.... store predictable but not essential attributes for a model

David Lowry asked in Rails

To be clearer - predictable but not essential, and always inheriting from defaults.

I have a series of sites based off the same codebase that at present I load with a settings file in application.rb. My 'baseline-settings' file comes first then 'specific-site' comes next, overriding things like colours, logo locations, public urls for relevant third parties, etc.

[EDIT: I'm replacing this multi-deploy version of same codebase with one application with multi-tenancy/subdomain features and ...] I'd rather not create model column entries for every one of those subdomains. I've read about things like OpenStruct but I can't find relevant up to date Rails related material on that.

Ideally I'd like this data to be manipulatable in ActiveAdmin or Administrate (i generally lean towards the former) and don't really mind what format it takes, but it should inherit from some master collection of data, which could be set in a yaml file (in order to generate the fields??)


It looks like might solve the 'easy defaults' element of this, but it appears there are issues with AA/Administrate... will keep investigating.

Any other suggestions?

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 84,256+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.