The Rails JSON encoder API requires as_json to take an optional arg

This commit is contained in:
Godfrey Chan
2013-11-29 21:43:44 -08:00
parent 7a60eacca9
commit 6bbea9de0b
6 changed files with 6 additions and 6 deletions

View File

@ -15,7 +15,7 @@ class Search
return topic_results.result_ids
end
def as_json
def as_json(options = nil)
@by_type.values.map do |grouped_result|
grouped_result.as_json
end

View File

@ -15,7 +15,7 @@ class Search
@url, @id, @title = row[:url], row[:id], row[:title]
end
def as_json
def as_json(options = nil)
json = {id: @id, title: @title, url: @url}
json[:avatar_template] = @avatar_template if @avatar_template.present?
json[:color] = @color if @color.present?

View File

@ -20,7 +20,7 @@ class Search
@result_ids << result.id
end
def as_json
def as_json(options = nil)
{ type: @type.to_s,
name: I18n.t("search.types.#{@type.to_s}"),
more: @more,