Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/53.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 在index.json.jbuilder中没有将字符串隐式转换为整数的类型错误_Ruby On Rails_Json_Ruby On Rails 4_Jbuilder - Fatal编程技术网

Ruby on rails 在index.json.jbuilder中没有将字符串隐式转换为整数的类型错误

Ruby on rails 在index.json.jbuilder中没有将字符串隐式转换为整数的类型错误,ruby-on-rails,json,ruby-on-rails-4,jbuilder,Ruby On Rails,Json,Ruby On Rails 4,Jbuilder,我正在使用Rails1.4.1和jbuilder 在index.json.jbuilder中输入代码 if @event_templates.count == 0 json.message "Not found" end 但它的错误是 Type Error no implicit conversion of String into Integer 如果我在索引页中给出simplejson.message“未找到”, 给同样的错误 我在这里做错了什么 但是同样的代码在show.jso

我正在使用Rails1.4.1和jbuilder

index.json.jbuilder
中输入代码

if @event_templates.count == 0
    json.message "Not found"
end 
但它的错误是

Type Error no implicit conversion of String into Integer
如果我在索引页中给出simple
json.message“未找到”
, 给同样的错误

我在这里做错了什么

但是同样的代码在
show.json.jbuilder

json.message "Not found"

它是完整的
index.json.jbuilder
?Post please
show.json.jbuilder
same-json.message“未找到”已解决,犯了一些小错误。干杯