mcasimir / friendly_id_schema

A Ruby Micro Gem for use FriendlyId with ActiveRecordSchema

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FriendlyIdSchema

FriendlyIdSchema is a micro gem that combines FriendlyId with ActiveRecordSchema

Installation

  gem 'friendly_id_schema', :git => "git://github.com/mcasimir/friendly_id_schema.git"

Usage

Call #permalink inside a model like this:

class Post
  permalink

  field :title
  
end

and then run rails g migration with --from option to let ActiveRecordSchema generate the required migration

ex.

rails g migration add_permalink_to_posts --from Post

Specify a field to derive permalink

class User
  field :name
  permalink :name
  
end

Use history

Run these commands first:

rails generate friendly_id
rake db:migrate
class Post
  permalink :history => true

  field :title
  
end

About

A Ruby Micro Gem for use FriendlyId with ActiveRecordSchema


Languages

Language:Ruby 100.0%