continuing the refactor of the admin section
This commit is contained in:
@@ -31,6 +31,11 @@ module BjController
|
||||
def controller_class_name
|
||||
"#{controller_name.classify.pluralize}Controller"
|
||||
end
|
||||
|
||||
def required_attribute_name
|
||||
m = model_name.classify.constantize
|
||||
m.validators.find{|v| v.is_a? ActiveModel::Validations::PresenceValidator }.try(:attributes).try(:first) || m.property_names.find{|k| k !~ /(_id|_at)$/}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user