I have a devise User model and a Profile model which belongs_to the User
class Profile < ApplicationRecord
belongs_to :user
end
The User model has a added column called name which stores the users name.
Im using friendly_id gem and want to apply it to the Profile model like so:
class Profile < ActiveRecord::Base
belongs_to :user
extend FriendlyId
friendly_id :name, use: :slugged
end
But rather than create another column in the Profile model called name, i want to use the User model column name here, which the profile belongs_to.
An answer from
friendly_idrepository owner to a similar question from Github issue:So it a nutshell, the slug must be placed in the same table.