Creating the simplest CMS in the world with Rails and Google docs

Last week a co-worker gave an interesting idea for a problem we had, basically we had a small part of our site that needed to be edited by non-technical people like a terms of service page that is written/reviewed by lawyers and managers in a company.

Instead of a full blow install wordpress and train people on how to edit pages there, what if we share a regular document on google docs and show its content on our site like a regular page?

It turns out that is really simple to achieve this with Jquery, and I’m going to to create a sample rails application to show you how:

For this example we going to load this document, that is public available, but it could be any document that is public shared for view:

ok, lets get started:

We have to install jquery since rails 5 doesn't ship it anymore, lets add t0 the Gemfile:

gem 'jquery-rails'

then run bundle install.

make your app/assets/javascripts/application.js look like:

add this content to app/views/pages/index.html.erb

We are almost there, now we just need some javascript to load the content stored on google docs.

Tada, here it is:

Thanks for reading and if you have any doubts please leave a comment below.