ChampsService: add tests and refactor
This commit is contained in:
parent
c5159dde4b
commit
4df03fc28e
6 changed files with 119 additions and 23 deletions
|
@ -28,6 +28,10 @@ class Champ < ActiveRecord::Base
|
|||
same_date? num, '%M'
|
||||
end
|
||||
|
||||
def mandatory_and_blank?
|
||||
mandatory? && value.blank?
|
||||
end
|
||||
|
||||
def same_date? num, compare
|
||||
if type_champ == 'datetime' && !value.nil?
|
||||
if value.to_datetime.strftime(compare) == num
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue