这是控制器中的代码,我收到错误请帮助我
class HomeController < ApplicationController
respond_to :json
def index
@home = Home.all
respond_with(@home)
cookies['AFID'] = {
:value => request.env['AFID'],
:expires => 1.year.from_now
}
cookies['SID'] = {
:value => request.env['SID'],
:expires => 1.year.from_now
}
#cookies[:AFID] = { :value =>}
end
def create
@homes = Home.create(params[:home])
respond_with(@home, :location => users_url)
end
end
我收到了以下错误消息 HomeController中的NameError #index
答案 0 :(得分:0)
首先,请使用代码缩进的Ruby约定!
如何将: value => request.env['AFID'],
修改为:value => request.env['AFID'],
?这有帮助吗?