訪問所有應用程序中的控制器的方法,使用的form_tag
我試圖使用引導,導航欄一個簡單的密碼驗證(這裏不要求用戶名)。
從application.html.erb:
<%= form_tag "/",:controller => 'application',:action => 'tryy' do %>
<%= label_tag "Enter password.." %>
<%= password_field_tag "login_password" %>
<div><%= submit_tag "Go!", :class=>'btn btn-success' %></div>
<% end %>
而且application_controller.rb:
class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :subd?, :tryy
def subd?
!((request.subdomain == '') || (request.subdomain=='www'))
end
def tryy
999
puts 999
end
end
在tryy的 '放' 就是要看到什麼是使用Rails服務器登錄窗口發生。
問題 - 提交表單時什麼也沒有發生,即沒有「999」打印。請注意,這裏也沒有錯誤消息。我懷疑這個方法「subd?」與此問題無關,但完全複製application_controller.rb,以防萬一。
關於我可能會丟失什麼的任何想法?