This commit is contained in:
r888888888
2014-03-19 15:35:09 -07:00
parent 3ea606d116
commit b77c5ee62c

View File

@@ -171,13 +171,17 @@ class PostVersion < ActiveRecord::Base
post.save! post.save!
end end
def updater_name
User.id_to_name(updater_id)
end
def serializable_hash(options = {}) def serializable_hash(options = {})
options ||= {} options ||= {}
options[:except] ||= [] options[:except] ||= []
options[:except] += hidden_attributes options[:except] += hidden_attributes
unless options[:builder] unless options[:builder]
options[:methods] ||= [] options[:methods] ||= []
options[:methods] += [:added_tags, :removed_tags, :obsolete_added_tags, :obsolete_removed_tags, :unchanged_tags] options[:methods] += [:added_tags, :removed_tags, :obsolete_added_tags, :obsolete_removed_tags, :unchanged_tags, :updater_name]
end end
hash = super(options) hash = super(options)
hash hash
@@ -186,7 +190,7 @@ class PostVersion < ActiveRecord::Base
def to_xml(options = {}, &block) def to_xml(options = {}, &block)
options ||= {} options ||= {}
options[:methods] ||= [] options[:methods] ||= []
options[:methods] += [:added_tags, :removed_tags, :obsolete_added_tags, :obsolete_removed_tags, :unchanged_tags] options[:methods] += [:added_tags, :removed_tags, :obsolete_added_tags, :obsolete_removed_tags, :unchanged_tags, :updater_name]
super(options, &block) super(options, &block)
end end
end end