debian-mirror-gitlab/app/models/users/saved_reply.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
468 B
Ruby
Raw Normal View History

2022-05-07 20:08:51 +05:30
# frozen_string_literal: true
module Users
class SavedReply < ApplicationRecord
self.table_name = 'saved_replies'
belongs_to :user
validates :user_id, :name, :content, presence: true
validates :name,
length: { maximum: 255 },
2023-04-23 21:23:45 +05:30
uniqueness: { scope: [:user_id] }
2022-05-07 20:08:51 +05:30
validates :content, length: { maximum: 10000 }
2023-04-23 21:23:45 +05:30
def self.find_saved_reply(user_id:, id:)
::Users::SavedReply.find_by(user_id: user_id, id: id)
end
2022-05-07 20:08:51 +05:30
end
end