diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 78849b78..a0080aba 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -129,7 +129,7 @@ class WikiController < ApplicationController if @page.save respond_to_success("Page reverted", :action => "show", :title => params[:title]) else - respond_to_error("Error reverting page", { :action => 'show', :title => params[:title] }) + respond_to_error((@page.errors.full_messages.first rescue "Error reverting page"), { :action => 'show', :title => params[:title] }) end end end diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index fce3bea6..9aac788e 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -107,15 +107,8 @@ class WikiPage < ActiveRecord::Base protected def ensure_changed - changed = false - latest = self.versions.latest - if self.body != latest.body - changed = true - elsif self.title != latest.title - changed = true - elsif self.is_locked != latest.is_locked - changed = true + unless (changed & ['title', 'body']).any? + errors.add :base, :no_change end - return changed end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 408c7e4e..7458ee41 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -106,7 +106,7 @@ en: moderate: uploaded_by_when_html: Uploaded by %{u} %{t_ago} (%{mod}) mod: mod - #models + # ActiveRecord (models) activerecord: attributes: #user.attributes @@ -114,6 +114,10 @@ en: password: Password current_password: Current password password_confirmation: Password confirmation + errors: + models: + wiki_page: + no_change: No change in page content/title #view/artist/create artist_create: "Separate multiple aliases and group members with commas." artist_name: "Name"