Module: ActiveReport::Validations::ClassMethods
- Defined in:
- lib/active_report/validations.rb
Instance Method Summary collapse
-
#validates_presence_of(*params) ⇒ Object
Ensures that the requested parameters exist and are not empty.
Instance Method Details
#validates_presence_of(*params) ⇒ Object
Ensures that the requested parameters exist and are not empty.
class TestReport < ActiveReport::Base
validates_presence_of :jobNumber
end
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/active_report/validations.rb', line 15 def validates_presence_of(*params) return if params.nil? send(:validate) do |report| params.each do |param| field = report.params[param.to_s] if field.blank? report.errors.add "#{param} must be defined" end end end end |