Kontent.ai
Copyright © 2023 Kontent.ai. All rights reserved.
  • Web
  • Privacy policy
  • Cookies policy
  • Consent settings
  • Security
  • GDPR
  • Documentation
  • API reference
  • Product updates
Kontent.ai Learn
  • Plan
  • Set up
  • Model
  • Develop
  • Create

Run the Ruby on Rails sample app

Is this page helpful?
Complete and continue
  • Sign in
    • JavaScript
      JavaScript
    • .NET
      .NET
    • PHP
      PHP
    • Ruby
      Ruby
    Jan Cerman
    2 minutes
    Run the Ruby on Rails sample app and connect it to your Kontent.ai sample project to see how your content is displayed.

    A quick check

    Make sure you have the following ready:
    • A Kontent.ai account
    • Ruby 3.1 installed
    • Your favorite IDE, for example, Visual Studio Code
      • See how to set up Ruby development on Windows

    Prepare your sample project

    Kontent.ai comes with a few sample projects to showcase best practices. The Ruby sample app is built around one of them.
    Here’s how you can create your own sample project:
    1. In Kontent.ai, click your initials in the bottom left corner.
    2. Select Projects.
    3. At the end of the list, click Create complete sample project.
    4. Select a subscription for the project.
    5. Click Create project.
    You now have a project named Sample Project you can use with the sample app!

    Clone the app

    Clone the sample app's repository to your device.

    Connect your Kontent.ai project

    Connect the app to your Sample Project so you can freely make changes.
    1. In Kontent.ai > Environment settings > General > Environment ID, copy the Environment ID for Production.
    2. In the sample app folder, open the /app/controllers/application_controller.rb file in your code editor.
    3. On line 3, replace <your-project-id> with your production environment ID.
    4. Save the file.

    Run the app

    1. In your command line, open the cloned repository.
    2. Run bundle install to install the necessary gem packages.
    3. Run the rails server to start the app.
    Open localhost:3000 in your browser to see the running sample app. Now, let’s explore the Sample Project and update its content so that you can see the changes reflected in your locally running application.
    What's next?
    Explore your sample project
    Let's explore your Kontent.ai sample project and update its content so that you can see the changes reflected in your locally running sample app.
    • Develop with Kontent.ai
    • Hello World
    • Hello Web Spotlight
    • Try sample apps
    • Build apps
    • Decide navigation and URLs
    • Environments
    • Get Developer Certification
    • shell
    git clone https://github.com/kontent-ai/sample-app-ruby.git
    • Run sample app
    • Adjust sample project
    Tip: We recommend using your own sample project. That way you can freely experiment with content and its model.
  • A quick check
  • Prepare your sample project
  • Clone the app
  • Connect your Kontent.ai project
  • Run the app