Sha256: 609d1a2852d0e883418b0317130e4ab44b3f0639979a98f3470d574ca75628dc

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

# == Schema Information
#
# Table name: accounts
#
#  id                 :bigint           not null, primary key
#  discarded_at       :datetime
#  nombre             :string           not null
#  plan               :integer          not null
#  created_at         :datetime         not null
#  updated_at         :datetime         not null
#  actualizado_por_id :bigint           indexed
#  creado_por_id      :bigint           indexed
#
# Foreign Keys
#
#  fk_rails_...  (actualizado_por_id => users.id)
#  fk_rails_...  (creado_por_id => users.id)
#

class Account < ApplicationRecord
  audited
  include Discard::Model
  include Hashid::Rails

  has_many :user_accounts
  has_many :users, through: :user_accounts

  belongs_to :creado_por, optional: true, class_name: 'User'
  belongs_to :actualizado_por, optional: true, class_name: 'User'

  enumerize :plan, in: { completar: 0, los: 1, valores: 2 }

  validates :plan, :nombre, presence: true

  ransacker :search do |parent|
    parent.table[:nombre]
  end

  def to_s
    nombre
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pg_rails-7.5.5 pg_engine/app/models/account.rb
pg_rails-7.5.4 pg_engine/app/models/account.rb
pg_rails-7.5.3 pg_engine/app/models/account.rb