0
我是新來的友好-id和我有這個在我的post.rb模型使用永久的,而不是在友好-ID
extend FriendlyId
friendly_id :title, use: :slugged
和friendly_id發電機遷移蛞蝓是
def change
create_table :friendly_id_slugs do |t|
t.string :slug, :null => false
t.integer :sluggable_id, :null => false
t.string :sluggable_type, :limit => 50
t.string :scope
t.datetime :created_at
end
add_index :friendly_id_slugs, :sluggable_id
add_index :friendly_id_slugs, [:slug, :sluggable_type]
add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope], :unique => true
add_index :friendly_id_slugs, :sluggable_type
end
和我與此遷移
def change
add_column :posts, :slug, :string
add_index :posts, :slug
Post.find_each(&:save)
end
但我想用永久的,而不是塞場像post.permalink加蛞蝓屬性我真的需要改變什麼?