Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7757637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:08:50+00:00 2026-06-01T13:08:50+00:00

I am trying to implement internationalization as seen in railscasts, and every time I

  • 0

I am trying to implement internationalization as seen in railscasts, and every time I scope my routes file I get the error

 No route matches [GET] "/"

or the error

missing :controller
config/routes.rb:6:in `block (2 levels) in <top (required)>'
config/routes.rb:5:in `block in <top (required)>'
config/routes.rb:1:in `<top (required)>'

Here is my routes.rb file

Jensenlocksmithing::Application.routes.draw do
  get "log_out" => "sessions#destroy", as: "log_out"
  get "log_in" => "sessions#new", as: "log_in"

  scope ":locale" do
    get "site/home"
    get "site/about_us"
    get "site/faq"
    get "site/discounts"
    get "site/services"
    get "site/contact_us"
    get "site/admin"
    get "site/posts"

    root :to => 'site#home'
  end

  #match '*path', to: redirect("/#{I18n.default_locale}/%{path}")
  #match '', to: redirect("/#{I18n.default_locale}")

  match "/savesort" => 'site#savesort'

  resources :users
  resources :abouts
  resources :sessions
  resources :coupons
  resources :monthly_posts
  resources :reviews

  resources :categories do
    collection { post :sort }
      resources :children, :controller => :categories, :only => [:index, :new, :create,  :new_subcategory]
  end
  resources :products do
    member do
       put :move_up
       put :move_down
   end 
  end
  resources :faqs do
    collection { post :sort }
  end 
end

So, why whenever I add the scope “:locale” do end line do I get these errors? It all works fine without. Let me know if you need to see any more code. Thanks guys

Edit

In my application controller I have the following:

private

def default_url_options(options = {})
  {locale: I18n.locale}  
end

Does this do the same thing as the passing the hash in the routes?

Edit 2

I changed my route to the following as seen in this gist.
https://gist.github.com/2322844

So why is the :id part being added to the get route? like this one

 about_us_site GET  /sites/:id/about_us(.:format)  

shouldn’t it be something like this

 about_us_site GET  /sites/about_us(.:format)

Also added my entire routes.rb file and the routes it generates for more information.
https://gist.github.com/2322861

Answer for anyone interested:

I changed

    get "site/home"
    get "site/about_us"
    get "site/faq"
    get "site/discounts"
    get "site/services"
    get "site/contact_us"
    get "site/admin"
    get "site/posts"

    root :to => 'site#home'

to

 resources :sites, except: [:new, :edit, :index, :show, :update, :destroy, :create] do  
   collection do  
   get :home  
   get :about_us  
   get :faq  
   get :discounts  
   get :services  
   get :contact_us  
   get :admin  
   get :posts  
 end  

end

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T13:08:51+00:00Added an answer on June 1, 2026 at 1:08 pm

    Passing in a hash should fix your routes:

    scope "(:locale)", :defaults => { :locale => "en" } do
      resources :sites
    end
    

    Also, you may want to consider creating a SitesController and giving it members:

    resources :sites do
      member do
        get :about_us # Points to /sites/about_us
      end
    end
    
    • Rails Guides on Defining Defaults In Routes
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement internationalization on my project, but the pages only get translated
While trying to implement an MVC file upload example on Scott Hanselman's blog. I
im trying to implement a custom error page, what i want to be able
Trying to implement simple error handling without adding buku try / except statements to
I am trying to implement internationalization in Tomcat. There are going to be different
I'm trying implement Data Annotation to my Linq to SQL objects. The .dbml file
Trying to implement AVAudioplayer and get some metering data of the played music, but
Im trying to implement a save feature to save an html file. Currently it
Trying to implement the new FP 10.1 Global error handler into my projects but
I'm trying to implement internationalization in JSF 2. I've tried many solutions, but I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.