Fix slug scope per tenant (#323)

This commit is contained in:
Riccardo Graziosi
2024-04-07 12:32:57 +02:00
committed by GitHub
parent 09fb156a4e
commit e301ada94a
3 changed files with 3 additions and 3 deletions

View File

@@ -10,7 +10,7 @@ class Board < ApplicationRecord
validates :name, presence: true, uniqueness: { scope: :tenant_id }
validates :description, length: { in: 0..1024 }, allow_nil: true
friendly_id :name, use: :slugged
friendly_id :name, use: :scoped, scope: :tenant_id
def sanitize_slug
self.slug = self.slug.parameterize

View File

@@ -19,7 +19,7 @@ class OAuth < ApplicationRecord
validates :scope, presence: true
validates :json_user_email_path, presence: true
friendly_id :generate_random_slug, use: :slugged
friendly_id :generate_random_slug, use: :scoped, scope: :tenant_id
def is_default?
tenant_id == nil

View File

@@ -16,7 +16,7 @@ class Post < ApplicationRecord
paginates_per Rails.application.posts_per_page
friendly_id :title, use: :slugged
friendly_id :title, use: :scoped, scope: :tenant_id
class << self
def find_with_post_status_in(post_statuses)