forked from protocool/enumerations_mixin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.rb
21 lines (19 loc) · 836 Bytes
/
init.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Copyright (c) 2005 Trevor Squires
# Released under the MIT License. See the LICENSE file for more details.
require 'active_record/acts/enumerated'
require 'active_record/aggregations/has_enumerated'
ActiveRecord::Base.class_eval do
include ActiveRecord::Acts::Enumerated
include ActiveRecord::Aggregations::HasEnumerated
end
# Virtual enumerations are useful if you've got a ton of different
# enumerations and don't care to litter your models directory with them.
# It's also handy if you want to define singleton methods for your
# enumerated values.
# See virtual_sample.txt in this directory for more info
if File.exist?("#{RAILS_ROOT}/config/virtual_enumerations.rb")
require 'active_record/virtual_enumerations'
silence_warnings do
eval(IO.read("#{RAILS_ROOT}/config/virtual_enumerations.rb"), binding)
end
end