> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/feature-management-experimentation/new-to-fme/sdks-and-customer-deployed-components/examples/ruby-sdk-example.md). Agents can also search and read this documentation through its [MCP server](https://developer.harness.io/~gitbook/mcp).

# Using the Ruby SDK with Rails and Sidekiq Service

Learn how to use the Ruby SDK with a Rails application and a Sidekiq background service to evaluate feature flags asynchronously.

## Overview

This example demonstrates a basic usage of the Ruby SDK integrated with a Rails application and Sidekiq background service to evaluate feature flags asynchronously.

This [example project](https://github.com/sanzmauro/poc-test-split-io/tree/split-with-sidekiq) requires an environment with Ruby 2.7.5.

## Setup

Follow the README instructions in the repo for detailed setup steps.

Run Sidekiq:

```bash
bundle exec sidekiq -e ${RACK_ENV:-development} -r ./sidekiq/config/application.rb -C ./sidekiq/config/sidekiq.yml
```

Run the Rails server:

```bash
rails s
```

## Test the feature flag evaluation

Send an HTTP request to the Rails server endpoint:

```bash
http://localhost:3030/test_global_feature_flag?key=<SOME-VALUE>&split_name=<YOUR-SPLIT-NAME>
```

After sending the request, check the Sidekiq console logs to see the result of the feature flag evaluations.

This example illustrates how to combine the Harness FME Ruby SDK with Rails and Sidekiq to handle feature flag evaluations in a background job, enabling scalable and asynchronous flag checks.

## Next steps

* Go to [Ruby SDK](https://developer.harness.io/feature-management-experimentation/new-to-fme/sdks-and-customer-deployed-components/server-side-sdks/ruby-sdk.md) to review the Ruby SDK configuration and methods.
* Go to [Implement caching with the Ruby SDK](https://developer.harness.io/feature-management-experimentation/new-to-fme/sdks-and-customer-deployed-components/examples/implement-caching-ruby.md) to cache Rails pages without serving stale treatments.

{% @harness-feedback/feedback %}
