mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-11 17:24:50 -04:00
Style/lint tidy up models
This commit is contained in:
@@ -46,7 +46,6 @@ class Garden < ApplicationRecord
|
||||
}.freeze
|
||||
validates :area_unit, inclusion: { in: AREA_UNITS_VALUES.values,
|
||||
message: "%<value>s is not a valid area unit" },
|
||||
allow_nil: true,
|
||||
allow_blank: true
|
||||
|
||||
after_validation :cleanup_area
|
||||
|
||||
@@ -57,11 +57,11 @@ class Harvest < ApplicationRecord
|
||||
validates :quantity, allow_nil: true, numericality: {
|
||||
only_integer: false, greater_than_or_equal_to: 0
|
||||
}
|
||||
validates :unit, allow_nil: true, allow_blank: true, inclusion: {
|
||||
validates :unit, allow_blank: true, inclusion: {
|
||||
in: UNITS_VALUES.values, message: "%<value>s is not a valid unit"
|
||||
}
|
||||
validates :weight_quantity, allow_nil: true, numericality: { only_integer: false }
|
||||
validates :weight_unit, allow_nil: true, allow_blank: true, inclusion: {
|
||||
validates :weight_unit, allow_blank: true, inclusion: {
|
||||
in: WEIGHT_UNITS_VALUES.values, message: "%<value>s is not a valid unit"
|
||||
}
|
||||
validate :crop_must_match_planting
|
||||
|
||||
@@ -56,10 +56,10 @@ class Planting < ApplicationRecord
|
||||
validates :quantity, allow_nil: true, numericality: {
|
||||
only_integer: true, greater_than_or_equal_to: 0
|
||||
}
|
||||
validates :sunniness, allow_nil: true, allow_blank: true, inclusion: {
|
||||
validates :sunniness, allow_blank: true, inclusion: {
|
||||
in: SUNNINESS_VALUES, message: "%<value>s is not a valid sunniness value"
|
||||
}
|
||||
validates :planted_from, allow_nil: true, allow_blank: true, inclusion: {
|
||||
validates :planted_from, allow_blank: true, inclusion: {
|
||||
in: PLANTED_FROM_VALUES, message: "%<value>s is not a valid planting method"
|
||||
}
|
||||
|
||||
|
||||
@@ -29,17 +29,17 @@ class Seed < ApplicationRecord
|
||||
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
|
||||
validates :days_until_maturity_max, allow_nil: true,
|
||||
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
|
||||
validates :tradable_to, allow_nil: false, allow_blank: false,
|
||||
inclusion: { in: TRADABLE_TO_VALUES, message: "You may only trade seed nowhere, "\
|
||||
validates :tradable_to, allow_blank: false,
|
||||
inclusion: { in: TRADABLE_TO_VALUES, message: "You may only trade seed nowhere, "\
|
||||
"locally, nationally, or internationally" }
|
||||
validates :organic, allow_nil: false, allow_blank: false,
|
||||
inclusion: { in: ORGANIC_VALUES, message: "You must say whether the seeds "\
|
||||
validates :organic, allow_blank: false,
|
||||
inclusion: { in: ORGANIC_VALUES, message: "You must say whether the seeds "\
|
||||
"are organic or not, or that you don't know" }
|
||||
validates :gmo, allow_nil: false, allow_blank: false,
|
||||
inclusion: { in: GMO_VALUES, message: "You must say whether the seeds are "\
|
||||
validates :gmo, allow_blank: false,
|
||||
inclusion: { in: GMO_VALUES, message: "You must say whether the seeds are "\
|
||||
"genetically modified or not, or that you don't know" }
|
||||
validates :heirloom, allow_nil: false, allow_blank: false,
|
||||
inclusion: { in: HEIRLOOM_VALUES, message: "You must say whether the seeds"\
|
||||
validates :heirloom, allow_blank: false,
|
||||
inclusion: { in: HEIRLOOM_VALUES, message: "You must say whether the seeds"\
|
||||
"are heirloom, hybrid, or unknown" }
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user