30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/i18n_fields.rb', line 30
def field(field_name, *args)
options = args.
multilingual = options.delete(:translatable) || options.delete(:multilingual)
args << options
if multilingual
@has_translations = true
translates field_name
self::Translation.class_eval do
field field_name, *args
field :locale
index :locale
schema.indexes.keys.each {|k|
schema.indexes[k].options ||= {}
schema.indexes[k].options[:name] = "index_#{SecureRandom::uuid}" }
timestamps
end
else
super(field_name, *args)
end
end
|