controller missing - locale

20 views
Skip to first unread message

Christopher Jones

unread,
Mar 29, 2012, 5:12:21 PM3/29/12
to rubyonra...@googlegroups.com
Hi all, I am having a problem at the moment with my code in which if I
incase my routes with scope '(:locale)' do buy I get the error
controller missing, any ideas why?

Games::Application.routes.draw do

scope '(:locale)' do
get "game_interest/new"
get "rules/index"
get "feedback/index"
get "help/index"

get "log_in" => "sessions#new", :as => "log_in"
get "log_out" => "sessions#destroy", :as => "log_out"
get "sign_up" => "users#new", :as => "sign_up"

get "home/index"
get "about/index"

resources :feedbacks
resources :password_resets
resources :contact_messages
resources :wishlists
resources :searches
resources :help
resources :users
resources :sessions

resources :games do
post 'email', :on => :member
post 'gensearch', :on => :member
post 'consearch', :on => :member
end

root :to => 'home#index'
end
end


I have the following in my application_controller

before_filter :set_i18n_locale_from_params

def set_i18n_locale_from_params
if params[:locale]
if I18n.available_locales.include?(params[:locale].to_sym)
I18n.locale = params[:locale]
else
flash.now[:notice] =
"#{params[:locale]} translation not available"
logger.error flash.now[:notice]
end
end
end

def default_url_options
{ :locale => I18n.locale }
end

--
Posted via http://www.ruby-forum.com/.

Tim Shaffer

unread,
Mar 30, 2012, 8:17:03 AM3/30/12
to rubyonra...@googlegroups.com
Can you paste the exact error that you are getting?

Christopher Jones

unread,
Apr 2, 2012, 9:30:13 AM4/2/12
to rubyonra...@googlegroups.com
Hi, I am receiving the following error:

ArgumentError

missing :controller
Rails.root: C:/Users/Christopher/Favorites/safety/safety 11/games

Application Trace | Framework Trace | Full Trace

config/routes.rb:4:in `block (2 levels) in <top (required)>'
config/routes.rb:3:in `block in <top (required)>'
config/routes.rb:1:in `<top (required)>'

This error occurred while loading the following files:
C:/Users/Christopher/Favorites/safety/safety
11/games/config/routes.rb

Christopher Jones

unread,
Apr 2, 2012, 9:54:39 AM4/2/12
to rubyonra...@googlegroups.com
No worries, solved.
Reply all
Reply to author
Forward
0 new messages