How to integrate online editors into your own website on Ruby
This example will help you integrate ONLYOFFICE Docs into your web application written on Ruby.
The integration examples are used to demonstrate document editors functions and the ways to connect Document Server to your own application.
DO NOT USE these examples on your own server without PROPER CODE MODIFICATIONS!
Step 1. Install ONLYOFFICE Docs
Download and install ONLYOFFICE Docs (packaged as Document Server).
See the detailed guide to learn how to install Document Server for Windows, for Linux, or for Docker.
Step 2. Install the prerequisites and run the website with the editors
- Install Ruby Version Manager (RVM) and the latest stable Ruby version:
gpg --keyserver "hkp://keys.gnupg.net" --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable --ruby
- Download the archive with the Ruby example and unpack the archive:
unzip Ruby\ Example.zip
- Change the current directory for the project directory:
cd Ruby\ Example
- Install the dependencies:
- Edit the application.rb configuration file.
Specify the name of your local server with the ONLYOFFICE Document Server installed.
Edit the following lines:
where the documentserver is the name of the server with the ONLYOFFICE Document Server installed and the storagePath is the path where files will be created and stored.
You can set an absolute path. For example, D:\\folder. Please note that on Windows OS the double backslash must be used as a separator.
- Run the Rails application:
rails s -b 0.0.0.0 -p 80
- See the result in your browser using the address:
If you want to experiment with the editor configuration, modify the parameters in the views\home\editor.html.erb file.
Step 3. Check accessibility
In case the example and Document Server are installed on different computers, make sure that your server with the example installed has access to the Document Server with the address which you specify instead of documentserver in the configuration files.
Make sure that the Document Server in its turn has access to the server with the example installed with the address which you specify instead of example.com in the configuration files.
If you integrated the editors successfully the result should look like the demo preview on our site.