Sha256: 5b790b36ad0c4f84389b15107a64892174d527fa6128f070416131e95defd66f

Contents?: true

Size: 637 Bytes

Versions: 64

Compression:

Stored size: 637 Bytes

Contents

class Evento
  include ActiveModel::API
  include ActionText::Attribute
  extend Enumerize

  attr_accessor :tooltip, :target, :message, :message_text, :type,
                :record_type, :record_id,
                :subject, :user_ids

  validates :target, :type, :message, presence: true

  enumerize :target, in: { todos: 0, devs: 1, user_ids: 2 }

  validates :message_text, :subject, presence: true, if: lambda {
    type == 'EmailUserNotifier'
  }

  validates :user_ids, presence: true, if: lambda {
    target == 'user_ids'
  }

  def record
    return if record_id.blank?

    record_type.constantize.find(record_id)
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
pg_rails-7.6.15 pg_engine/app/models/evento.rb
pg_rails-7.6.14 pg_engine/app/models/evento.rb
pg_rails-7.6.13 pg_engine/app/models/evento.rb
pg_rails-7.6.12 pg_engine/app/models/evento.rb
pg_rails-7.6.11 pg_engine/app/models/evento.rb
pg_rails-7.6.10 pg_engine/app/models/evento.rb
pg_rails-7.6.9 pg_engine/app/models/evento.rb
pg_rails-7.6.8 pg_engine/app/models/evento.rb
pg_rails-7.6.7 pg_engine/app/models/evento.rb
pg_rails-7.6.6 pg_engine/app/models/evento.rb
pg_rails-7.6.5 pg_engine/app/models/evento.rb
pg_rails-7.6.4 pg_engine/app/models/evento.rb
pg_rails-7.6.3 pg_engine/app/models/evento.rb
pg_rails-7.6.2 pg_engine/app/models/evento.rb
pg_rails-7.6.1 pg_engine/app/models/evento.rb
pg_rails-7.6.0 pg_engine/app/models/evento.rb
pg_rails-7.5.7 pg_engine/app/models/evento.rb
pg_rails-7.5.6 pg_engine/app/models/evento.rb
pg_rails-7.5.5 pg_engine/app/models/evento.rb
pg_rails-7.5.4 pg_engine/app/models/evento.rb