4
5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/rails_admin_image_manager/has_managed_file.rb', line 4
def has_managed_file(attribute, id, options={})
var_options_name = "@has_managed_file_#{attribute}_options"
var_options_value = instance_variable_get(var_options_name)
if var_options_value.nil?
instance_variable_set(var_options_name, options)
add_managed_file_belongs_to(attribute, managed_file_options_mandatory(options))
add_managed_file_validates_presence_of(id) if managed_file_options_mandatory(options)
add_managed_file_before_validation(attribute, id) unless managed_file_options_mandatory(options)
end
end
|