Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto include macros in Mongoid. #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/validates_formatting_of/railtie.rb
Expand Up @@ -5,12 +5,20 @@ class Railtie < Rails::Railtie
ActiveSupport.on_load :active_record do
extend ModelAdditions
end

ActiveSupport.on_load :mongoid do
::ClassMethods.send(:include, ModelAdditions)
end
end

initializer 'validates_formatting_of.validations' do
ActiveSupport.on_load :active_record do
include Validations
end

ActiveSupport.on_load :mongoid do
ActiveModel::Validations.send(:include, Validations)
end
end
end
end
2 changes: 1 addition & 1 deletion validates_formatting_of.gemspec
Expand Up @@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
gem.require_paths = ["lib"]
gem.version = ValidatesFormattingOf::VERSION

gem.add_dependency "activemodel", "~> 3.0"
gem.add_dependency "activemodel", ">= 3.0"

gem.add_development_dependency "rake"
gem.add_development_dependency "rspec"
Expand Down