当我try 获取所有类别(索引操作)时,出现错误:
undefined local variable or method `json'
But in show action everything fine. All files has .jbuilder extension. Here is controller code:
def index
@categories = Category.all
end
# GET /categories/1
# GET /categories/1.json
def show
@category = Category.find(params[:id])
end
堆栈跟踪:
app/views/categories/index.json.builder:1:in
_app_views_categories_index_json_builder___502133872307116590_70140532925300' actionpack (3.2.11) lib/action_view/template.rb:145:in
block in render'
activesupport (3.2.11) lib/active_support/notifications.rb:125:ininstrument'
render'
actionpack (3.2.11) lib/action_view/template.rb:143:in