Skip to content

Instantly share code, notes, and snippets.

@jeffkreeftmeijer
Created September 19, 2011 12:53
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffkreeftmeijer/1226439 to your computer and use it in GitHub Desktop.
Save jeffkreeftmeijer/1226439 to your computer and use it in GitHub Desktop.
class PirateValidator < ActiveModel::Validator
end
require 'active_model'
require File.expand_path('app/validators/pirate_validator')
class Validatable
include ActiveModel::Validations
validates_with PirateValidator
end
@jeffkreeftmeijer
Copy link
Author

Don't want to load up spec/rails/extensions? Put validations.rb in your support directory and require 'support/validations' instead. It saves me ~ 2 seconds. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment