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.1.14 pg_engine/app/models/evento.rb
pg_rails-7.1.13 pg_engine/app/models/evento.rb
pg_rails-7.1.12 pg_engine/app/models/evento.rb
pg_rails-7.1.11 pg_engine/app/models/evento.rb
pg_rails-7.1.10 pg_engine/app/models/evento.rb
pg_rails-7.1.9 pg_engine/app/models/evento.rb
pg_rails-7.1.8 pg_engine/app/models/evento.rb
pg_rails-7.1.7 pg_engine/app/models/evento.rb
pg_rails-7.1.6 pg_engine/app/models/evento.rb
pg_rails-7.1.5 pg_engine/app/models/evento.rb
pg_rails-7.1.4 pg_engine/app/models/evento.rb
pg_rails-7.1.3 pg_engine/app/models/evento.rb
pg_rails-7.1.2 pg_engine/app/models/evento.rb
pg_rails-7.1.1.pre.6 pg_engine/app/models/evento.rb
pg_rails-7.1.1.pre.5 pg_engine/app/models/evento.rb
pg_rails-7.1.1.pre.4 pg_engine/app/models/evento.rb
pg_rails-7.1.1.pre.3 pg_engine/app/models/evento.rb
pg_rails-7.1.1.pre.2 pg_engine/app/models/evento.rb
pg_rails-7.1.1.pre.1 pg_engine/app/models/evento.rb
pg_rails-7.1.0 pg_engine/app/models/evento.rb