Skip to content

Commit

Permalink
Document necessary location of slug column (resolves #293)
Browse files Browse the repository at this point in the history
This adds a point of clarification in the rdoc and inside the globalize module itself to point out that the slug column must be present on the translation table, not the primary model table itself. It also (real friendly-like) corrects some faulty parallelism.
  • Loading branch information
robyurkowski committed Jul 3, 2012
1 parent 16abf37 commit dc78438
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Guide.rdoc
Expand Up @@ -480,8 +480,8 @@ languages. If your application only needs to be localized to one or two
languages, you may wish to consider the {FriendlyId::SimpleI18n SimpleI18n} languages, you may wish to consider the {FriendlyId::SimpleI18n SimpleI18n}
module. module.


In order to use this module, your model must have a slug column and set the In order to use this module, your model's translation table must have a slug
field +slug+ as translable with Globalize: column and must set the field +slug+ as translatable with Globalize:


class Post < ActiveRecord::Base class Post < ActiveRecord::Base
translates :title, :slug translates :title, :slug
Expand Down Expand Up @@ -549,4 +549,4 @@ For example:
def move_friendly_id_error_to_name def move_friendly_id_error_to_name
errors.messages[:name] = errors.messages.delete(:friendly_id) errors.messages[:name] = errors.messages.delete(:friendly_id)
end end
end end
4 changes: 2 additions & 2 deletions lib/friendly_id/globalize.rb
Expand Up @@ -13,8 +13,8 @@ module is most suitable for applications that need to be localized to many
languages, you may wish to consider the {FriendlyId::SimpleI18n SimpleI18n} languages, you may wish to consider the {FriendlyId::SimpleI18n SimpleI18n}
module. module.
In order to use this module, your model's table must have a slug column, and you In order to use this module, your model's translation table must have a slug
must set the field +slug+ as translatable with Globalize: column, and you must set the field +slug+ as translatable with Globalize:
class Post < ActiveRecord::Base class Post < ActiveRecord::Base
translates :title, :slug translates :title, :slug
Expand Down

0 comments on commit dc78438

Please sign in to comment.