README.markdown in permalink-0.1.1 vs README.markdown in permalink-1.0.0

- old
+ new

@@ -1,53 +1,48 @@ -has_permalink -============= +Permalink +========= Instalation ----------- -You can use I18n-JS as plugin and gem. Choose what's best for you! - - script/plugin install git://github.com/fnando/has_permalink.git - -or gem install permalink Usage ----- -Add the method call `has_permalink` to your model. Your model should have a `permalink` attribute. +Add the method call `permalink` to your model. Your model should have a `permalink` attribute. class Page < ActiveRecord::Base - has_permalink :title + permalink :title end You can specify the permalink field: class page < ActiveRecord::Base - has_permalink :title, :to => :title_permalink + permalink :title, :to => :title_permalink end -If you don't want to use `has_permalink`, you can call `'some text'.to_permalink` string method and +If you don't want to use `permalink`, you can call `'some text'.to_permalink` string method and manage the permalink process by yourself. -Permalinks are not unique by default. `has_permalink` overrides `to_param` as following: +Permalinks are not unique by default. `permalink` overrides `to_param` as following: def to_param "#{id}-#{permalink}" end You can define the `to_param` format: class Page < ActiveRecord::Base - has_permalink :title, :to_param => %w(id permalink page) + permalink :title, :to_param => %w(id permalink page) end The above settings will generate something link `100-some-title-page`. By overriding `to_param` method you don't have to change a thing on your app routes. -If you want to generate unique permalink, use the option `:unique`: +If you want to generate unique permalink, use the `:unique` option: class Page < ActiveRecord::Base - has_permalink :title, :unique => true, :to_param => :permalink + permalink :title, :unique => true, :to_param => :permalink end The permalink is generated using `ActiveSupport::Multibyte::Chars` class; this means that characters will properly replaced from `áéíó` to `aeio`, for instance. The permalink is created when `before_validation` callback is evaluated. This plugin also tries \ No newline at end of file