Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

edit json response

  • Loading branch information...
commit 9db20376b3d1c721952303fce6bfe3c4d9e7bb8c 1 parent d89718d
@hisa110 authored
Showing with 2 additions and 3 deletions.
  1. +2 −3 app/controllers/mokumoku_controller.rb
View
5 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
Please sign in to comment.
Something went wrong with that request. Please try again.