-2

I'm a bit new in rails development I'm modeling a website with few resources and so far so good. But here is my question:

I would like to allow the admin users to manage information show in most of the pages: Application name, telephone number, address, default email and this kind of things.

My current idea is make a model Property with name and value, but somehow I'm not convinced about this approach because I'll need to access the database to get this values for every request.

Thanks everyone for your time! :D

HatsuMora
  • 194
  • 1
  • 8

1 Answers1

0

This seems like an OK approach. If you implement caching, it no longer will hit the db with every request, and honestly it probably isn't really that big of a deal even without the caching. Build it the way you need, and optimize afterward, if necessary.

With all this being said, it may be worth considering how much things like the phone number are going to change, and balance the cost of developing a dynamic solution against the time it would take to change once, 3 years from now (if the number ever does change), in a partial.

Brad Werth
  • 17,411
  • 10
  • 63
  • 88
  • Thanks for the feed back! Then I might use a static module of some sort, so I don't have to replace and repeat the strings all over the place, everytime I need to update them. – HatsuMora Oct 27 '18 at 20:55