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 7738971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:24:15+00:00 2026-06-01T08:24:15+00:00

I am following Ryan Bates railscasts I18n Internationalization and hitting a problem/question. I am

  • 0

I am following Ryan Bates railscasts I18n Internationalization and hitting a problem/question.

I am trying to set the language in my link, something like this:

http://localhost:3000/en/site/services for english

and

http://localhost:3000/es/site/services for spanish

I am defining this in my routes file here:

routes.rb

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"
  get "categories/new_subcategory"
  get "categories/edit_subcategory"
end

and I have in my application controller

before_filter :set_locale

private
  def set_locale
  I18n.locale = params[:locale] if params[:locale].present?
end

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

And in my views/layouts/application.html.erb

<%= link_to_unless_current "English", locale: "en" %> |
<%= link_to_unless_current "Spanish", locale: "es" %> 

Now, whenever I try to run rake routes or navigate to the URL I get

C:\www\project>rake routes
  rake aborted!
  missing :controller

I am fairly new to routes, can someone help me see/explain the problem?
Thanks in advance.

  • 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-01T08:24:17+00:00Added an answer on June 1, 2026 at 8:24 am

    I just pasted all the code you posted into a new rails app and it worked. My guess is that you have other routes in your routes.rb file and one of them is invalid. The routes you posted come out like this:

    mike@sleepycat:~/projects/testproj$ rake routes
    site_home GET /:locale/site/home(.:format)               :locale/site#home
    site_about_us GET /:locale/site/about_us(.:format)       :locale/site#about_us
    site_faq GET /:locale/site/faq(.:format)                 :locale/site#faq
    site_discounts GET /:locale/site/discounts(.:format)     :locale/site#discounts
    site_services GET /:locale/site/services(.:format)       :locale/site#services
    site_contact_us GET /:locale/site/contact_us(.:format)   :locale/site#contact_us
    site_admin GET /:locale/site/admin(.:format)             :locale/site#admin
    site_posts GET /:locale/site/posts(.:format)             :locale/site#posts
    categories_new_subcategory GET /:locale/categories/new_subcategory(.:format)  :locale/categories#new_subcategory
    categories_edit_subcategory GET /:locale/categories/edit_subcategory(.:format) :locale/categories#edit_subcategory
    

    While you might be capable of something like that the question is should you. I would strongly suggest reading up on Resource Oriented Architecture if you aren’t already familiar with it. I wouldn’t suggest bending Rails into strange shapes until you have a good grasp on that. Its the concept that Rails routing is based on and what goes on in routes.rb won’t make much sense until you understand that.

    There is plenty available on the internet and a good book that clarified things for me is Restful Web services by Leonard Richardson and Sam Ruby.
    I hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Following Ryan Bates' instructions on creating a before_filter that sets a time_zone like so
I'm trying to deploy to a VPS following Ryan Bates screencast. I'm using thin
I'm following the tutorial from Ryan B, but I got something wrong when trying
I've been following Ryan Bates Railscast on Subdomains http://railscasts.com/episodes/221-subdomains-in-rails-3 and using lvh.me to serve
I'm following Ryan Bates' declarative authorization railscast. I'm trying to add functionality for author
I am following Ryan Bates' railcasts: http://railscasts.com/episodes/37-simple-search-form in solving my issue with the search
I am using Rails 3.2.5. Following Ryan Bates tutorial. http://railscasts.com/episodes/145-integrating-active-merchant . My order.rb has
I'm following Ryan Bate's instructions for using Omniauth to set up third party authentication,
I am trying to use Ryan Bates 'letter-opener' gem as described in Episode #104
I am trying to follow Ryan Bates screencast but have an error message. I

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.