Skip to content

Commit

Permalink
fixed rubocop issues;
Browse files Browse the repository at this point in the history
  • Loading branch information
ktpe committed Nov 15, 2024
1 parent 66b1690 commit 56892f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/models/calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Calculator < ApplicationRecord
friendly_id :en_name, use: :sequentially_slugged

translates :name

has_many :fields, dependent: :destroy
has_many :formulas, dependent: :destroy

Expand Down
8 changes: 4 additions & 4 deletions app/models/field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ class Field < ApplicationRecord

has_many :categories, dependent: :destroy

NUMBER = "number".freeze
CATEGORY = "category".freeze
KINDS = { number: NUMBER, category: CATEGORY }.freeze
NUMBER = "number"
CATEGORY = "category"
KINDS = { number: NUMBER, category: CATEGORY }.freeze

enum :kind, KINDS
enum :unit, { day: 0, week: 1, month: 2, year: 3, date: 4, times: 5, money: 6, items: 7 }

validates :kind, presence: true
validates :uk_label, :en_label, presence: true, length: { minimum: 3, maximum: 50 }
validates :var_name, presence: true, format: { with: /\A[a-zA-Z_]+\z/ }

validates_with FieldValidator

accepts_nested_attributes_for :categories, reject_if: :all_blank, allow_destroy: true
Expand Down

0 comments on commit 56892f5

Please sign in to comment.