Files
nairobi/app/models/budget/content_block.rb
Javi Martín 0911b89d16 Add name attribute to heading content blocks
This way we can simplify the code and don't have to rely on `.try`
statements which are confusing and so we don't allow them in the
`Rails/SafeNavigation` Rubocop rule.
2021-02-05 17:46:23 +01:00

10 lines
303 B
Ruby

class Budget
class ContentBlock < ApplicationRecord
validates :locale, presence: true, inclusion: { in: I18n.available_locales.map(&:to_s) }
validates :heading, presence: true, uniqueness: { scope: :locale }
belongs_to :heading
delegate :name, to: :heading, allow_nil: true
end
end