我尝试从railsCast#37创建一个示例搜索表单: railscasts.com/episodes/37-simple-search-form
我的文字字段看起来不可见或隐藏。这是我的代码:
查看:
get {
(path("token") & parameters("email", "password")) { (email, password) =>
complete {
DBManager.getUserByEmail(email) map {
case Some(user) =>
UserWire(user)
case None =>
StatusCodes.NotFound -> "User doesn't exist"
}
}
}
}
控制器:
<div>
<% form_tag 'mainbase', :method => 'get' do %>
<p>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search", :name => nil %>
</p>
<% end %>
型号:
@students = Student.search(params[:search])
答案 0 :(得分:2)
你错过了等号。
<%= form_tag 'mainbase', :method => 'get' do %>