0

我想确保用户为我的网站启用了 cookie,所以我使用了本指南

但是,当我运行我的服务器时,我发现了这个错误:

syntax error, unexpected $end, expecting keyword_end
map.cookies_test “cookie_test”, :controller...

这是我的 application_controller.rb :

class ApplicationController < ActionController::Base
    protect_from_forgery
    include CookieDetection
    include SessionsHelper
end

和我的 routes.rb :

Basketball::Application.routes.draw do

  map.cookies_test “cookie_test”, :controller => “application”, :action => “cookie_test”

  resources :games 

  resources :teams

  get "teams/new"
  get "games/new"

  resources :users
  resources :sessions, only: [:new, :create, :destroy]

  root to: 'static_pages#home'

  match '/signup',  to: 'users#new'
  match '/signin',  to: 'sessions#new'
  match '/signout', to: 'sessions#destroy', via: :delete  

  match '/help',    to: 'static_pages#help'
  match '/about',   to: 'static_pages#about'
  match '/contact', to: 'static_pages#contact'

end

更新

我已将引号从“智能”引号更改为普通引号(根据 Edward),但现在出现错误:

undefined local variable or method `map' for#
<ActionDispatch::Routing::Mapper:0x007ff9ca996800> (NameError)

更新

我已将 Map 更改为 Match(根据 Edward),现在出现错误:

`match': wrong number of arguments (0 for 1) (ArgumentError)
4

1 回答 1

3

在你的路线文件中,看起来你有“智能”引号“”,而不是普通的“

我希望您错误地剪切和粘贴了它们。

编辑


更改地图以匹配 - 地图是 rails 2

于 2013-03-01T17:09:20.967 回答