简体   繁体   中英

Where to store static / “index” page content in database in Rails

I've been using Rails for a few weeks now and have loved using it to make a fully-baked application. Now, I'm trying to use it for an agency site where we have services, articles and projects (which fit models and controllers nicely)

I've created the usual new/edit form views for these and it works perfectly (even have Redactor JS set up nicely with it)

The bit where it all feels a bit awkward is trying to allow for editing on the "index" pages - ie: the Services page itself would not only list each service but would have a few different bits of text and buttons that ideally I'd like to be able to content manage. Ditto for some content on contact pages and the like.

I've looked at using ActiveAdmin (which looks like a great tool, but ideally I'd like to keep it less serious and edit these pages in the front-end, this looks a perfect tool for managing large amounts of data)

Am just wondering how experienced devs would go about this? Would you have a model/controller for every page so that you could have routes like services/edit, home/edit, or perhaps there is some other way? Or maybe I'm just trying to get Rails to do something it's not really made for?

Thanks.

This probably comes down to

  • who's going to edit these semi-static pages?

  • how often?

If you're the only one doing it, no more than once a month, then just set up static pages with appropriate controllers.

If a bunch of people are doing it, on a fairly frequent basis, then go with ActiveAdmin, or a CMS gem, or etc.

Don't let 'elegant' get in the way of 'just do it'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM