JShoe
JShoe

Reputation: 3428

Rails Cookie Detection Script Fails

I wanted to make sure that users have cookies enabled for my site, so I used this guide.

However, when I run my server, I gut this error:

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

Here's my application_controller.rb :

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

and my 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

Update

I have changed my quotes from "smart" quotes to plain quotes (as per Edward), but I am now getting the error:

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

Update

I have changed Map to Match (as per Edward) and am now getting the error:

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

Upvotes: 0

Views: 77

Answers (1)

Edward
Edward

Reputation: 3499

In your routes file, it look like you've got "smart" quotes “” ,rather than plain "

I expect you've cut and pasted them by mistake.

Edit


Change map to match - map is rails 2

Upvotes: 3

Related Questions