У меня проблема с edit_user_path(user)
в моем файле rspec:
it "should forward to the requested page after signin" do
user = Factory(:user)
visit edit_user_path(user)
fill_in :email, :with => user.email
fill_in :password, :with => user.password
click_button
response.should render_template('users/edit')
end
Я получаю эту ошибку:
Failure/Error: visit edit_user_path(user)
ActionController::RoutingError:
No route matches {:action=>"edit", :controller=>"users", :locale=>#<User id: 1, name: "Max Mustermann", email: "mel@example.com", encrypted_password: "1b0befc5caf12c2abf53d99sdfsd5ba15ebe28362eae21b2fb3...", salt: "331ca07444f5dcee76605bsdfasd95c833b7d5135b36a253723...", created_at: "2011-02-03 18:54:34", updated_at: "2011-02-03 18:54:34">}
Понятия не имею, почему он использует user
как :locale
и почему нет :id
с user.id
.Я использую :locale
для установки языка, например localhost: 3000 / en / home или localhost: 3000 / de / home.
Это мой routs.rb
:
Hoapp::Application.routes.draw do
scope '(:locale)', :locale => /de|en/ do
resources :users
resources :sessions, :only => [:new, :create, :destroy]
resources :hotels, :only => [:create, :destroy]
root :to => 'pages#home'
match '/signup', :to => 'users#new'
match '/signin', :to => 'sessions#new'
match '/signout', :to => 'sessions#destroy'
match '/about', :to => 'pages#about'
match '/blog', :to => 'pages#blog'
match '/contact', :to => 'pages#contact'
match '/help', :to => 'pages#help'
match '/overview', :to => 'pages#overview'
match '/preview', :to => 'pages#preview'
match '/settings', :to => 'pages#settings'
match 'm', :to => 'mobile#home'
match 'apartments', :to => 'mobile#apartments'
match 'apartment_info', :to => 'mobile#apartment_info'
match 'apartment_images', :to => 'mobile#apartment_images'
match 'apartment_price', :to => 'mobile#apartment_price'
match 'wellness', :to => 'mobile#wellness'
match 'test', :to => 'mobile#test'
scope "m" do
resources :requests, :only => [:new, :create]
match 'request_sent', :to => 'requests#sent'
end
match ':vanity_url/', :to => "mobile#home"
end