Getting Started with Editmode for Rails
Last updated
Last updated
Install The Gem
Generate your config
Configure caching
We use the rails cache to store content. This means if you don't have caching enabled your app will run quite slow.
Setting up cache expiration webhooks
When an editor makes changes inside the Content Hub, we need a way to let the Rails app know and expire the cache for that particular content. We use cache expiration webhooks for this. The rails gem comes pre-loaded with endpoints to receive and expire the cache, so all you have to do is configure your project settings to notify the app when content is updated.
Adding cache expiration endpoints in your project settings
One caveat is that this method obviously won’t work when working with content locally. To bring your local content in sync with remote changes on the Content Hub, you should enter Editmode and select “Clear Cache”.
Bringing local content up to date with remote changes.
We are using a method called delete_matched
to purge your caches when a content gets updated, and this method isn’t supported in memcached
. We highly recommend using redis_store
or file_store
.
There is full documentation on all of the editmode gem's methods and settings here.
Our 2 minute explainer video below should help you understand the
basics.
Then, to help you get kicked off, we've also added code snippets
that you can repurpose for your app.
Video: Editmode For Rails - Basic Syntax (2 minutes)
Setup Step 1. Create a collection in Editmode with "From", "Subject" and "Body" fields
Setup Step 2. Add a chunk to the newly created collection.