Permalink
Browse files

edit json response

  • Loading branch information...
hisa110 committed May 23, 2012
1 parent d89718d commit 9db20376b3d1c721952303fce6bfe3c4d9e7bb8c
Showing with 2 additions and 3 deletions.
  1. +2 −3 app/controllers/mokumoku_controller.rb
@@ -11,7 +11,7 @@ def ret
flist=[]
Find.find($yaml_dir+'/'+path) {|f|
if File::ftype(f) == "file"
- if /_#{$response_code}.yml$/ =~ f then
+ if /_#{$response_code}.json$/ =~ f then
flist.push f
end
@@ -20,9 +20,8 @@ def ret
# random
jsonpath=flist.sort_by{|i| rand }.first
-
# return
- render :text => s = File.read(jsonpath, :encoding => Encoding::UTF_8), :status=>$response_code
+ render :json => JSON.parse(File.read(jsonpath, :encoding => Encoding::UTF_8)), :status=>$response_code
end
end

0 comments on commit 9db2037

Please sign in to comment.