Remove duplicate Translation classes
We accidentally added them twice when rebasing the translations branch.
This commit is contained in:
@@ -229,16 +229,4 @@ class Budget < ApplicationRecord
|
|||||||
slug.nil? || drafting?
|
slug.nil? || drafting?
|
||||||
end
|
end
|
||||||
|
|
||||||
class Translation < Globalize::ActiveRecord::Translation
|
|
||||||
validate :name_uniqueness_by_budget
|
|
||||||
|
|
||||||
def name_uniqueness_by_budget
|
|
||||||
if Budget.joins(:translations)
|
|
||||||
.where(name: name)
|
|
||||||
.where.not("budget_translations.budget_id": budget_id).any?
|
|
||||||
errors.add(:name, I18n.t("errors.messages.taken"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -39,19 +39,5 @@ class Budget
|
|||||||
def generate_slug?
|
def generate_slug?
|
||||||
slug.nil? || budget.drafting?
|
slug.nil? || budget.drafting?
|
||||||
end
|
end
|
||||||
|
|
||||||
class Translation < Globalize::ActiveRecord::Translation
|
|
||||||
delegate :budget, to: :globalized_model
|
|
||||||
|
|
||||||
validate :name_uniqueness_by_budget
|
|
||||||
|
|
||||||
def name_uniqueness_by_budget
|
|
||||||
if budget.groups.joins(:translations)
|
|
||||||
.where(name: name)
|
|
||||||
.where.not("budget_group_translations.budget_group_id": budget_group_id).any?
|
|
||||||
errors.add(:name, I18n.t("errors.messages.taken"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -59,20 +59,5 @@ class Budget
|
|||||||
def generate_slug?
|
def generate_slug?
|
||||||
slug.nil? || budget.drafting?
|
slug.nil? || budget.drafting?
|
||||||
end
|
end
|
||||||
|
|
||||||
class Translation < Globalize::ActiveRecord::Translation
|
|
||||||
delegate :budget, to: :globalized_model
|
|
||||||
|
|
||||||
validate :name_uniqueness_by_budget
|
|
||||||
|
|
||||||
def name_uniqueness_by_budget
|
|
||||||
if budget.headings
|
|
||||||
.joins(:translations)
|
|
||||||
.where(name: name)
|
|
||||||
.where.not("budget_heading_translations.budget_heading_id": budget_heading_id).any?
|
|
||||||
errors.add(:name, I18n.t("errors.messages.taken"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user