Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Guardrail captures validation errors from your Ruby on Rails application to help you identify and fix user experience issues. The GuardrailNotifier gem makes it easy to hook up your Rails app to the Guardrail web service.

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .document
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 guardrail_notifier.gemspec


Stop hurting your users!

Guardrail captures validation errors from your Ruby on Rails application to help you identify and fix user experience issues. The GuardrailNotifier gem makes it easy to hook up your app to the Guardrail web service.

If you haven't already signed up for a Guardrail account, visit


Rails 3

  • Add the following line to Gemfile:

    gem 'guardrail_notifier'
  • Install the gem:

    bundle install

Rails 2.3

  • Add the following line to config/environment.rb:

    config.gem 'guardrail_notifier'
  • Install the gem:

    [sudo] rake gems:install GEM=guardrail_notifier


In your Rails app, create config/initializers/guardrail_notifier.rb and add the following line with the API key for your Guardrail project:

GuardrailNotifier.configure do |config|
  config.api_key = "<YOUR API KEY>"

Or, if you prefer to keep API keys and the like out of your code, set the GUARDRAIL_API_KEY environment variable and GuardrailNotifier will find it automatically.

Validation errors will now be submitted to the Guardrail service on your create and update actions in production mode.

Advanced Usage

Tracking custom actions

GuardrailNotifier assumes your app is RESTful, so it only monitors the create and update actions by default. If you're creating or updating records in non-RESTful actions, you can use an after_filter to make sure any validation failures in those actions are caught as well:

after_filter :log_validation_failures_to_guardrail, :only => [:create, :update, :my_custom_action]

Running in other environments

GuardrailNotifier is only enabled in the production environment by default. If you want to enable it in additional environments, such as staging, you'll need to add the following line to your Guardrail initializer:

GuardrailNotifier.configure do |config|
  config.monitored_environments << 'staging'


GuardrailNotifier uses a secure connection over SSL by default, but you can easily disable it if you prefer:

GuardrailNotifier.configure do |config| = false

Filtering params

GuardrailNotifier records the parameters submitted in actions that cause validation errors. Because your app may handle sensitive data, like passwords, credit card numbers, and nuclear launch codes, GuardrailNotifier respects the parameter filtering that you configure in Rails in config/application.rb (Rails 3) or ApplicationController (Rails 2.3). For example in Rails 3:

config.filter_parameters += [:password, :secret, :cvv]

Per Rails convention, those params will show up as “[FILTERED]” in the data submitted to Guardrail.

Contact information

  • Twitter: @guardrailapp

  • Email:

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.





Copyright © 2012 Terrible Labs, Inc. See LICENSE for details.

Something went wrong with that request. Please try again.