Ruby feature flags installation

Add this to your Gemfile:

Terminal
gem "posthog-ruby"

In your app, set your API key before making any calls. If setting a custom host, make sure to include the protocol (e.g. https://).

Ruby
require 'posthog'
posthog = PostHog::Client.new({
api_key: "<ph_project_api_key>",
host: "https://us.i.posthog.com",
on_error: Proc.new { |status, msg| print msg }
})

You can find your project API key and instance address in the project settings page in PostHog.

Next steps

ResourceDescription
Adding feature flag codeHow to check flags in your code for all platforms
Framework-specific guidesSetup guides for React Native, Next.js, Flutter, and other frameworks
How to do a phased rolloutGradually roll out features to minimize risk
More tutorialsOther real-world examples and use cases

Community questions

Was this page useful?

Questions about this page? or post a community question.