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.5.3 pg_engine/app/models/evento.rb
pg_rails-7.5.2 pg_engine/app/models/evento.rb
pg_rails-7.5.1 pg_engine/app/models/evento.rb
pg_rails-7.5.0 pg_engine/app/models/evento.rb
pg_rails-7.4.3 pg_engine/app/models/evento.rb
pg_rails-7.4.2 pg_engine/app/models/evento.rb
pg_rails-7.4.1 pg_engine/app/models/evento.rb
pg_rails-7.4.0 pg_engine/app/models/evento.rb
pg_rails-7.3.5 pg_engine/app/models/evento.rb
pg_rails-7.3.4 pg_engine/app/models/evento.rb
pg_rails-7.3.3 pg_engine/app/models/evento.rb
pg_rails-7.3.2 pg_engine/app/models/evento.rb
pg_rails-7.3.1 pg_engine/app/models/evento.rb
pg_rails-7.3.0 pg_engine/app/models/evento.rb
pg_rails-7.2.3 pg_engine/app/models/evento.rb
pg_rails-7.2.2 pg_engine/app/models/evento.rb
pg_rails-7.2.1 pg_engine/app/models/evento.rb
pg_rails-7.2.0 pg_engine/app/models/evento.rb
pg_rails-7.1.16 pg_engine/app/models/evento.rb
pg_rails-7.1.15 pg_engine/app/models/evento.rb