Files
document-server-integration/web/documentserver-example/ruby
2023-07-27 11:26:40 +04:00
..
2023-07-18 10:35:31 +04:00
2023-07-18 10:35:31 +04:00
2023-07-27 11:26:40 +04:00
2022-08-02 16:50:01 +03:00
2023-06-09 12:13:40 +04:00
2023-07-27 11:26:40 +04:00
2023-07-27 11:26:40 +04:00
2023-07-27 11:26:40 +04:00
2023-07-12 13:44:20 +04:00
2023-07-27 11:26:40 +04:00
2020-09-02 12:06:52 +03:00
2023-07-17 18:26:09 +04:00
2022-03-28 12:05:45 +03:00

Overview

This example will help you integrate ONLYOFFICE Docs into your web application written on Ruby.

Please note: It is intended for testing purposes and demonstrating functionality of the editors. Do NOT use this integration example on your own server without proper code modifications! In case you enabled the test example, disable it before going for production.

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

  1. 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
    
  2. Download the archive with the Ruby example and unpack the archive:

    wget "https://api.onlyoffice.com/app_data/editor/Ruby%20Example.zip"
    
    unzip Ruby\ Example.zip
    
  3. Change the current directory for the project directory:

    cd Ruby\ Example
    
  4. Install the dependencies:

    bundle install
    
  5. Edit the application.rb configuration file. Specify the name of your local server with the ONLYOFFICE Document Server installed.

    nano config/application.rb
    

    Edit the following lines:

    Rails.configuration.storagePath="app_data"
    Rails.configuration.urlSite="https://documentserver/"
    

    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.

  6. Run the Rails application:

    rails server -u webrick
    rails s -b 0.0.0.0 -p 80
    
  7. See the result in your browser using the address:

    http://localhost
    

    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 has access to the server with the example installed with the address which you specify instead of example.com in the configuration files.

Important security info

Please keep in mind the following security aspects when you are using test examples:

  • There is no protection of the storage from unauthorized access since there is no need for authorization.
  • There are no checks against parameter substitution in links, since the parameters are generated by the code according to the pre-arranged scripts.
  • There are no data checks in requests of saving the file after editing, since each test example is intended for requests only from ONLYOFFICE Document Server.
  • There are no prohibitions on using test examples from other sites, since they are intended to interact with ONLYOFFICE Document Server from another domain.