我目前正在將craigslist作爲基本導軌項目進行重製。我有一個AJAX請求在主頁上的登錄鏈接,顯示包含登錄部分的div。如何在導軌中正確渲染部分4
_login.html.erb
<%= form_for @user, url: { action: "/authenticate" } do |f| %>
<%= f.label :email %>
<%= f.text_field :email %><br>
<%= f.label :password %>
<%= f.text_field :password %>
<%= f.submit "Log In!" %>
<%= flash[:notice] %>
<% end %>
categories_controller.rb又名我的主頁的操作方法是這樣的:
def index
@user = User.all
@categories = Category.all
end
,我發現了錯誤:「無路由匹配{:action =>「/ users_controller/authenticate」,:controller =>「categories」}「
How do我將表單路由到另一個控制器中的另一個操作方法? (即users_controller)