fixes #837
This commit is contained in:
@@ -52,7 +52,29 @@ class WikiPage < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
module ApiMethods
|
||||
def serializable_hash(options = {})
|
||||
options ||= {}
|
||||
options[:except] ||= []
|
||||
options[:except] += hidden_attributes
|
||||
unless options[:builder]
|
||||
options[:methods] ||= []
|
||||
options[:methods] += [:creator_name]
|
||||
end
|
||||
hash = super(options)
|
||||
hash
|
||||
end
|
||||
|
||||
def to_xml(options = {}, &block)
|
||||
options ||= {}
|
||||
options[:procs] ||= []
|
||||
options[:procs] << lambda {|options, record| options[:builder].tag!("creator-name", record.creator_name)}
|
||||
super(options, &block)
|
||||
end
|
||||
end
|
||||
|
||||
extend SearchMethods
|
||||
include ApiMethods
|
||||
|
||||
def self.find_title_and_id(title)
|
||||
titled(title).select("title, id").first
|
||||
@@ -81,7 +103,7 @@ class WikiPage < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def creator_name
|
||||
User.id_to_name(user_id).tr("_", " ")
|
||||
User.id_to_name(creator_id).tr("_", " ")
|
||||
end
|
||||
|
||||
def category_name
|
||||
|
||||
Reference in New Issue
Block a user