Skip to content

Commit

Permalink
Add installation instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
smtlaissezfaire committed Nov 17, 2009
1 parent 177c863 commit 49d6fb8
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,32 @@

Generate slugs for your models

== Installation

Throw it in vendor/plugins (with script/plugin install, braid, submodules, or whatever your preferred installation method), and add the following to a model you'd like to slug:

class MyClass < ActiveRecord::Base
include Slugify
slugify :title
end

If you are using slugify in multiple models, you may want to mix it into ActiveRecord::Base:

ActiveRecord::Base.instance_eval do
include Slugify
end

class MyClass < ActiveRecord::Base
slugify :title
end

== Examples

class Page < ActiveRecord::Base
include Slugify

validates_presence_of :title

slugify :title
end

Expand All @@ -31,7 +50,7 @@ Generate slugs for your models
=== Conditional slug generation:

slugify :my_column, :when => lambda { |my_record| my_record.published? }

== Contributors

kule - STI Issues [Github Issue #1]

0 comments on commit 49d6fb8

Please sign in to comment.