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:
parent
b9e7276394
commit
526b9aab0c
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user