Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在这个问题之后,我想知道是否有办法覆盖新的 rails 行为。我遇到了一个被遗忘的视图的安全问题,尽管该操作未在我的控制器中定义,但它突然暴露出来。我认为最好阻止 Rails 呈现那些未定义的操作,然后清理我未使用的视图。
更改该控制器的路由以不路由到这些操作。
resources :users, :except => [:index, :destroy] resources :sessions, :only => [:new, :create, :destroy]
即使视图存在,这些路由也将变得不可路由,然后您可以根据需要处理视图。