diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-07-23 11:26:04 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-07-23 11:26:04 +0000 |
commit | d74f0bfd5c53962e332c2dd4d30dafaa1105b92b (patch) | |
tree | f3eaf66d67c3a87fb34340561bf188d364de623c /app/models/wiki_page.rb | |
parent | 41bb302594b48152b87c92f196c915f499093bbf (diff) | |
download | redmine-d74f0bfd5c53962e332c2dd4d30dafaa1105b92b.tar.gz redmine-d74f0bfd5c53962e332c2dd4d30dafaa1105b92b.zip |
Merged rails-5.1 branch (#23630).
git-svn-id: http://svn.redmine.org/redmine/trunk@16859 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/wiki_page.rb')
-rw-r--r-- | app/models/wiki_page.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index d7b09f357..6e4cf0c03 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -47,7 +47,6 @@ class WikiPage < ActiveRecord::Base validates_uniqueness_of :title, :scope => :wiki_id, :case_sensitive => false validates_length_of :title, maximum: 255 validates_associated :content - attr_protected :id validate :validate_parent_title before_destroy :delete_redirects @@ -80,6 +79,10 @@ class WikiPage < ActiveRecord::Base end def safe_attributes=(attrs, user=User.current) + if attrs.respond_to?(:to_unsafe_hash) + attrs = attrs.to_unsafe_hash + end + return unless attrs.is_a?(Hash) attrs = attrs.deep_dup @@ -122,7 +125,7 @@ class WikiPage < ActiveRecord::Base # Moves child pages if page was moved def handle_children_move - if !new_record? && wiki_id_changed? + if !new_record? && saved_change_to_wiki_id? children.each do |child| child.wiki_id = wiki_id child.redirect_existing_links = redirect_existing_links |