Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Documentation fixes. Added vim swapfiles to gitignore.

  • Loading branch information...
commit 2b5d3d37a3fa80dc1cbf60f24e9cb6b46cc28ff3 1 parent f920b19
@norman norman authored
View
1  .gitignore
@@ -3,3 +3,4 @@
doc
pkg
coverage
+*.swp
View
4 lib/friendly_id.rb
@@ -45,7 +45,7 @@ module ClassMethods
# * <tt>:cache_column</tt> - Defaults to nil. Use this column as a cache for generating to_param (experimental).
# * <tt>:strip_diacritics</tt> - Defaults to false. If true, it will remove accents, umlauts, etc. from western characters.
# * <tt>:strip_non_ascii</tt> - Defaults to false. If true, it will all non-ascii ([^a-z0-9]) characters.
- # * <tt>:reserved</tt> - Array of words that are reserved and can't be used as friendly_id's. For sluggable models, if such a word is used, it will be treated the same as if that slug was already taken (numeric extension will be appended). Defaults to ["new", "index"].
+ # * <tt>:reserved</tt> - Array of words that are reserved and can't be used as friendly_id's. For sluggable models, if such a word is used, it will raise a FriendlyId::SlugGenerationError. Defaults to ["new", "index"].
# * <tt>:reserved_message</tt> - The validation message that will be shown when a reserved word is used as a frindly_id. Defaults to '"%s" is reserved'.
#
# You can also optionally pass a block if you want to use your own custom
@@ -58,7 +58,7 @@ module ClassMethods
# # Use stringex to generate the friendly_id rather than the baked-in methods
# text.to_url
# end
- # end
+ # end
def has_friendly_id(column, options = {}, &block)
options.assert_valid_keys VALID_FRIENDLY_ID_KEYS
unless options.has_key?(:cache_column)
View
4 lib/friendly_id/sluggable_instance_methods.rb
@@ -34,7 +34,7 @@ def has_better_id?
has_a_slug? and found_using_numeric_id? || found_using_outdated_friendly_id?
end
- # Has the record (at least) one slug?
+ # Does the record have (at least) one slug?
def has_a_slug?
@finder_slug_name || slug
end
@@ -80,7 +80,7 @@ def slug_text
end
base = Slug::normalize(base)
end
-
+
if base.mb_chars.length > friendly_id_options[:max_length]
base = base.mb_chars[0...friendly_id_options[:max_length]]
end
Please sign in to comment.
Something went wrong with that request. Please try again.