我不断收到“NoMethodError at /dataset_requests/create undefined method `session' for #”。DatasetRequest 是一个模型,而不是控制器。该问题是由闪存和重定向方法引起的。可能是什么问题?
我的控制器:
Ims.controllers :dataset_requests do
get :index do
@requests = DatasetRequest.all(:account_id => current_account.id, :order => [:date_requested.desc])
render 'dataset_requests/index'
end
post :create do
@request = DatasetRequest.new(params[:dataset_request])
@request.account_id = current_account.id
@request.date_requested = DateTime.now
if @request.save
flash[:notice] = 'Request was successfully created.'
redirect url(:dataset_requests, :index)
else
flash[:error] = 'Request could not be created.'
render 'dataset_requests/index'
end
end
end