BathHacked/energy-sparks

View on GitHub
app/models/case_study.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# == Schema Information
#
# Table name: case_studies
#
#  created_at :datetime         not null
#  id         :bigint(8)        not null, primary key
#  position   :integer          default(0), not null
#  title      :string
#  updated_at :datetime         not null
#
class CaseStudy < ApplicationRecord
  extend Mobility
  include TransifexSerialisable
  include TranslatableAttachment

  translates :title, type: :string, fallbacks: { cy: :en }
  translates :description, backend: :action_text

  t_has_one_attached :file

  validates :title, :file_en, presence: true
  validates :position, numericality: true, presence: true
end