norman/friendly_id-globalize

Unique Slugs by Scope not working

pranav7 opened this issue · 1 comments

Even after using :scope, friendly_id is generating a hashed version of the slug.

friendly_id (5.1.0)
rails (5.1.4)
ruby (2.1.4

class Board < ApplicationRecord
  extend FriendlyId
  friendly_id :name, use: [:scoped, :slugged, :history], scope: :company

  belongs_to :company
  has_many :posts

  validates :slug, presence: true, uniqueness: { scope: :company }
end
> Board.create name: "Test Board", company: company
=> #<Board:0x007f8e192b53f0
 id: 19,
 company_id: 19,
 name: "Test Board",
 description: nil,
 created_at: Fri, 06 Oct 2017 09:06:26 UTC +00:00,
 updated_at: Fri, 06 Oct 2017 09:06:26 UTC +00:00,
 slug: "test-board">

> Board.create name: "Test Board", company: company
=> #<Board:0x007f8e1bb4e820
 id: 20,
 company_id: 19,
 name: "Test Board",
 description: nil,
 created_at: Fri, 06 Oct 2017 09:06:40 UTC +00:00,
 updated_at: Fri, 06 Oct 2017 09:06:40 UTC +00:00,
 slug: "test-board-1781b893-4c25-4875-acf4-0fb23ca09c52">

Am I missing something? I referred to: http://norman.github.io/friendly_id/file.Guide.html#Unique_Slugs_by_Scope

Created by mistake in the wrong repo. Move to norman/friendly_id#840