From 70e0edf000289b1907b8aee386daf23577f6bc08 Mon Sep 17 00:00:00 2001 From: Tony Jian Date: Sun, 29 Apr 2012 14:15:36 +0800 Subject: Make non English title indexable (such as Chinese or Japanese) using MD5. --- guides/rails_guides/indexer.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'guides') diff --git a/guides/rails_guides/indexer.rb b/guides/rails_guides/indexer.rb index 89fbccbb1d..1847f09881 100644 --- a/guides/rails_guides/indexer.rb +++ b/guides/rails_guides/indexer.rb @@ -59,8 +59,9 @@ module RailsGuides def title_to_idx(title) idx = title.strip.parameterize.sub(/^\d+/, '') - if warnings && idx.blank? - puts "BLANK ID: please put an explicit ID for section #{title}, as in h5(#my-id)" + if idx.blank? + puts "BLANK ID: please put an explicit ID for section #{title}, as in h5(#my-id)" if warnings + idx = ("id-"+Digest::MD5.hexdigest(title.strip)).parameterize.sub(/^\d+/, '') end idx end -- cgit v1.2.3 From bf7b8cf6b31837ee9751cd174f128022c0fc5bb4 Mon Sep 17 00:00:00 2001 From: Tony Jian Date: Sun, 29 Apr 2012 17:07:30 +0800 Subject: Revert "Make non English title indexable (such as Chinese or Japanese) using MD5." This reverts commit 70e0edf000289b1907b8aee386daf23577f6bc08. --- guides/rails_guides/indexer.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'guides') diff --git a/guides/rails_guides/indexer.rb b/guides/rails_guides/indexer.rb index 1847f09881..89fbccbb1d 100644 --- a/guides/rails_guides/indexer.rb +++ b/guides/rails_guides/indexer.rb @@ -59,9 +59,8 @@ module RailsGuides def title_to_idx(title) idx = title.strip.parameterize.sub(/^\d+/, '') - if idx.blank? - puts "BLANK ID: please put an explicit ID for section #{title}, as in h5(#my-id)" if warnings - idx = ("id-"+Digest::MD5.hexdigest(title.strip)).parameterize.sub(/^\d+/, '') + if warnings && idx.blank? + puts "BLANK ID: please put an explicit ID for section #{title}, as in h5(#my-id)" end idx end -- cgit v1.2.3 From 74f328f0ab7b20694037385adb5220e340a36bd7 Mon Sep 17 00:00:00 2001 From: Kevin Richardson Date: Sun, 29 Apr 2012 13:42:33 -0400 Subject: Fix 'Can't mass-assign protected attributes: tags_attributes' in Rails 3.2.3. --- guides/source/getting_started.textile | 1 + 1 file changed, 1 insertion(+) (limited to 'guides') diff --git a/guides/source/getting_started.textile b/guides/source/getting_started.textile index 6a761b6a46..02cc7be029 100644 --- a/guides/source/getting_started.textile +++ b/guides/source/getting_started.textile @@ -2127,6 +2127,7 @@ class Post < ActiveRecord::Base has_many :comments, :dependent => :destroy has_many :tags + attr_protected :tags accepts_nested_attributes_for :tags, :allow_destroy => :true, :reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } } -- cgit v1.2.3