1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

[bug] unable to create/edit plan of 12 months/53 weeks

This commit is contained in:
Sylvain 2019-01-16 12:10:07 +01:00
parent b9e7276394
commit 526b9aab0c

View File

@ -27,8 +27,8 @@ class Plan < ActiveRecord::Base
validates :amount, :group, :base_name, presence: true
validates :interval_count, numericality: { only_integer: true, greater_than_or_equal_to: 1 }
validates :interval_count, numericality: { less_than: 12 }, if: proc { |plan| plan.interval == 'month' }
validates :interval_count, numericality: { less_than: 52 }, if: proc { |plan| plan.interval == 'week' }
validates :interval_count, numericality: { less_than: 13 }, if: proc { |plan| plan.interval == 'month' }
validates :interval_count, numericality: { less_than: 53 }, if: proc { |plan| plan.interval == 'week' }
validates :interval, inclusion: { in: %w[year month week] }
validates :base_name, :slug, presence: true