じぶんのroutes.rb
MyApp::Application.routes.draw do
scope '(:locale)' do
#all resources here
end
namespace :blog do
resources :posts, :only => [:index, :show]
end
end
じぶんのapplication_controller.rb
class ApplicationController < ActionController::Base
#
#
before_filter :set_locale
private
def default_url_options(options = {})
{locale: I18n.locale}
end
def set_locale
#code for detect locale here
end
#
#
end
内部のすべてのリソースscope '(:locale)'
は正常に機能しています。
ただし、ロケールを使用したくないのでnamespace :blog
、ブログのリンクをクリックしようとすると、この URL が表示されますhttp://localhost:3000/blog/posts?locale=en
namespace :blog...
とのロケールを削除するにはどうすればよいblog resource
ですか?. http://localhost:3000/blog/posts
削除したいようなURLを取得したい?locale=en
ありがとう!