This guide is for integrating Scrivito into a new or existing Rails application. It assumes that you already registered at Scrivito.com, and that Ruby, Rails, and the required tools are installed on your machine. See installrails.com, for example, on how to install Ruby and Rails. The instructions refer to Mac OS X, and Ubuntu 14.04 LTS installations. Microsoft Windows is not supported. We recommend using the latest Ruby version. Currently, Scrivito supports Rails 4.2 and 5.0.
If you are starting from scratch, please follow the instructions below. Should you already have a furnished Rails application, consider prudently running
bundle update prior to integrating Scrivito from step 2.
If you'd rather experiment with a ready-to-use Scrivito-enabled application that comes with several sample pages, widgets, a blog and much more, feel free to download and use the Scrivito Example Application.
$ rails new NAME_OF_YOUR_APPLICATION
gem "scrivito", "~> 1.9"
$ bundle install
As Turbolinks conflicts with proper Scrivito operation please remove it's references in:
Require these assets in
//= require jquery //= require jquery_ujs //= require scrivito
Require these assets in
/* *= require scrivito ... */
scrivito_head_tags to the
head section and
scrivito_body_tags to the
body section in
app/views/layouts/application.html.erb. The result should look like this:
<html> <head> <title>Scrivito Application</title> … <%= scrivito_head_tags %> … </head> <body> <%= yield %> … <%= scrivito_body_tags %> … </body> </html>
The values of the keys can be obtained from your Scrivito Account after clicking the gear icon of the CMS instance you would like to use (you only need one set).
If you are comfortable using a bash shell (use
echo $SHELL to find out), edit the ~/.bashrc or ~/.zshrc file and add:
export SCRIVITO_TENANT=tenant_id export SCRIVITO_API_KEY=secret
Or, we recommend to use the “dotenv-rails” gem and create a
.env file in your project, then add the
KEY=VALUE pairs to the file.
The Scrivito API keys are your personal keys. Never give them to anyone not involved in developing your Scrivito website! If you use the “.env” mechanism, add this file name to your “.gitignore” file.
$ rails g scrivito:install
If you opted to use
dotenv-rails, uncomment and update
config.tenant = ENV["SCRIVITO_TENANT"]
config.api_key = ENV["SCRIVITO_API_KEY"]
$ bundle exec rake scrivito:migrate scrivito:migrate:publish
Using the Bootstrap or Foundation framework is simple and fast.