2014-06-18 2 views
0

나는 PBP - 레일이있는 애자일 웹 개발과 로케일 스위처 구현에 바쁘다. 나는 영어와 스페인어 사이의 전환을 시도 할 때로케일 스위처

그러나 나는 오류가 발생합니다 :

class StoreController < ApplicationController 
    skip_before_filter :authorize 

    def index 
    if params[:set_locale] 
     redirect_to store_path(locale: params[:set_locale]) 
    else 
     @products = Product.order(:title) 
     @cart = current_cart 
    end 
    end 
end 

하고있는 application.hmtl.erb의 추출물을 다음과 같이

No route matches [POST] "/en" 

내 컨트롤러입니다 사용되고있다.

scope'(:locale)' do 
    resources :users 
    resources :orders 
    resources :line_items 
    resources :carts 
    resources :products do 
    get :who_bought, on: :member 
    end 
root to: 'store#index', as: 'store' 
end 

내가 뭘 잘못했는지 알아낼 질수 다음과 같이

<div id="banner"> 
    <%= form_tag store_path, class: 'locale' do %> 
    <%= select_tag 'set_locale', options_for_select(LANGUAGES, I18n.locale.to_s), onchange: 'this.form.submit()' %> 
    <%= submit_tag 'submit' %> 
    <%= javascript_tag "$('.locale input').hide()" %> 
    <% end %> 
    <%= image_tag("logo.png") %> 
    <%= @page_title || t('.title') %> 
</div> 

라우팅 폴더입니다./en 또는/es를 입력하면 제대로 작동합니다. 그러나 그 드롭 다운을 선택하는 것이 내가 오류 당신은 가이드와 같은 범위에 슬래시를 누락

답변

0

이 문제 발견의 때 form_tag이었다 게시물을 기대 나는

012에

<%= form_tag store_path, class: 'locale' do %> 

을 변경할 수 있도록