svenfuchs / routing-filter

routing-filter wraps around the complex beast that the Rails routing system is, allowing for unseen flexibility and power in Rails URL recognition and generation.
http://www.artweb-design.de
MIT License
464 stars 84 forks source link

rails4 undefined local variable or method map #55

Open bodaonline opened 9 years ago

bodaonline commented 9 years ago

Hi All,

I am new to Rails. I tried to setup routing-filter with basic settings as per seen in the wiki/Localize_filter but go this error when starting the server:

/home/ubuntu/workspace/stuff/config/routes.rb:18:in block in <top (required)>': undefined local variable or methodmap' for #ActionDispatch::Routing::Mapper:0x0000000852e2e0 (NameError)

I have this in routes.rb:

Rails.application.routes.draw do
  map.filter 'locale'
  root 'static_pages#home'
  resources :categories
  resources :users, only: [:index, :show]
  resources :items
  devise_for :users
  get 'users/index'
  get 'users/show'
  resources :addresses do
     collection { post :import }
  end
end

I have set up routing.rb, application-controller.rb, environment.rb as per described in the Wiki.

simi commented 9 years ago

What version are you using?

bodaonline commented 9 years ago

0.5.0

fabn commented 9 years ago

That wiki page refers to rails 2 documentation, there's no need to use map.filter you should replace it in your code with:

Rails.application.routes.draw do
  # map.filter 'locale'
  filter :locale
  # ...
end
simi commented 9 years ago

Ahh, I missed that @fabn. @bodaonline does this work for you?

bodaonline commented 9 years ago

Hi @fabn and @simi ! Thanks for your reply but no luck. I guess if that wiki page is for rails2 there are other mines in it. Know of any uptodate guide? TIA!