Rails Cookie检测脚本失败

时间:2013-03-01 16:54:12

标签: ruby-on-rails ruby cookies session-cookies

我想确保用户为我的网站启用了Cookie,因此我使用了this guide

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

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

更新

我已将我的引号从“智能”引号更改为普通引号(根据爱德华),但我现在收到错误:

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

更新

我已将地图更改为匹配(根据爱德华),现在我收到了错误:

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

1 个答案:

答案 0 :(得分:3)

在你的路线文件中,看起来你有“聪明”的引号“”,而不是简单的“

我希望你错误地剪掉并粘贴它们。

修改


将地图更改为匹配 - 地图为rails 2