路由中的Rails 3 + HTTPS约束:无法为UsersController找到操作“show”

时间:2013-08-29 17:20:33

标签: ruby-on-rails ssl https

我尝试仅在特定网址上强制使用SSL(在这种情况下是用户帐户设置),我看到了这一点:Rails 3 SSL Deprecation。这是我原来的路线:

resources :users do
  collection do
    get :thanks
    get :change_password
    get :settings
  end
end

我在阅读完答案后将其更改为此内容;

resources :users do
  scope :constraints => { :protocol => 'https' } do
    collection do
      get :thanks
      get :change_password
      get :settings
    end
  end
end

但是现在让我们说当我尝试进入设置页面时,The action 'show' could not be found for UsersController实际上应该由User#settings处理它时会出现错误。我做错了什么?

1 个答案:

答案 0 :(得分:0)

scope :constraints => { :protocol => 'https' } do
  resources :users do
    collection do
      get :thanks
      get :change_password
      get :settings
    end
  end
end

范围第一。我想......