Sha256: 463b18f1e1c23afd85dba3e1aff0a699b11ea3fef221e3bc089a89c1ce3f0eb8

Contents?: true

Size: 528 Bytes

Versions: 2

Compression:

Stored size: 528 Bytes

Contents

# frozen_string_literal: true

module TelegramChatbot
  class ChatGroup < ApplicationRecord
    TELEGRAM_CHAT_TYPES = %w[group supergroup]
    TELEGRAM_SUPER_GROUP = "supergroup"
    TELEGRAM_GROUP = "group"

    belongs_to :telegram_bot, primary_key: "token", foreign_key: "bot_token"

    scope :actives, -> { where(actived: true) }

    validates :title, presence: true
    validates :chat_id, presence: true
    validates :chat_type, presence: true
    validates :chat_type, inclusion: { in: TELEGRAM_CHAT_TYPES }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
telegram_chatbot-0.1.3 app/models/telegram_chatbot/chat_group.rb
telegram_chatbot-0.1.1 app/models/telegram_chatbot/chat_group.rb