Installation
This guide covers installing the Toggly Ruby SDK packages.
Requirements
- Ruby: 3.2 or later
- Rails: 7.0 or later (for toggly-rails) Use a Ruby version supported by your chosen Rails version; the gem minimums above do not override framework requirements.
Installation Options
Core SDK Only
For pure Ruby applications without Rails:
gem 'toggly'
With Rails Integration
For Rails applications:
gem 'toggly-rails'
This automatically includes the core toggly gem as a dependency.
With Redis Caching
For applications needing Redis-based persistence:
gem 'toggly-rails' # or gem 'toggly'
gem 'toggly-cache'
Complete Setup
Add optional transports only when you use the corresponding capability:
gem 'toggly-rails'
gem 'toggly-cache'
gem 'websocket-client-simple', '~> 0.8' # Live updates
gem 'grpc' # Default telemetry transport
gem 'google-protobuf' # Telemetry messages
Running Installation
After adding the gem(s) to your Gemfile:
bundle install
Rails Generator
If using toggly-rails, generate the initializer:
rails generate toggly:install
This creates config/initializers/toggly.rb with a starter configuration.
Verifying Installation
Ruby
require 'toggly'
puts Toggly::VERSION
# Prints the installed version
Rails
rails console
Toggly::Rails::VERSION
# Prints the installed version
Troubleshooting
Bundle Install Fails
Make sure you have Ruby 3.2 or later:
ruby --version
Rails Generator Not Found
Ensure the gem is properly installed:
bundle exec rails generate --help | grep toggly
# toggly:install
Version Conflicts
Let Bundler resolve the core and adapter dependencies together, and commit Gemfile.lock. Core and Rails adapter version numbers are independent; do not require matching minor versions. Inspect the dependency conflict before choosing a targeted update:
bundle update toggly toggly-rails