Contentful integration for Rails
The following is a tutorial on how to easily integrate Contentful into a Ruby on Rails application. The following blog post assumes that you have created a Content Model inside of Contentful and added some pieces of content.
Include the following line in your
Gemfile and then execute
Head to the API Keys section under setting and copy both your
Space ID and
Content Delivery API - access token. We will set these as environment variables using the names
The helper function
lib folder I have created a
ContentfulHelper which will essentially act as the bridge that talks to the Contentful service.
require 'contentful' module ContentfulHelper @contentful ||= Contentful::Client.new( access_token: ENV['CONTENTFUL_ACCESS_TOKEN'], space:
Continue reading →