Sha256: 9dc943ab695008e83c0802b0a7c4b859d9d99fe82b4ee1bb44be90d1b2e0e0d0

Contents?: true

Size: 571 Bytes

Versions: 4

Compression:

Stored size: 571 Bytes

Contents

module CitizenBudgetModel
  class Section < ActiveRecord::Base
    acts_as_list scope: :simulator_id, top_of_list: 0
    translates :title, :description, :modal, :popover, fallbacks_for_empty_translations: true
    globalize_accessors

    belongs_to :simulator
    has_many :questions, -> { order(:position) }, dependent: :destroy

    validates_presence_of :simulator_id

    # Returns the section's title or "Untitled"
    #
    # @return [String] the section's title or "Untitled"
    def display_name
      title.present? && title || _('Untitled')
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
citizen_budget_model-0.0.4 app/models/citizen_budget_model/section.rb
citizen_budget_model-0.0.3 app/models/citizen_budget_model/section.rb
citizen_budget_model-0.0.2 app/models/citizen_budget_model/section.rb
citizen_budget_model-0.0.1 app/models/citizen_budget_model/section.rb