我有一个关于搜索代码表报销并在表用户中通过用户名输入的问题。这是表单搜索:
<%= form_tag reimburses_searchreimburse_path, method: :get do %>
<%= text_field_tag :reimburse, params[:reimburse] %>
<%= submit_tag "Search", name: nil%>
<% end %>
这是控制器
def searchreimburse
@users = User.where("username LIKE ? ", "%#{params[:reimburse]}%")
@reimburses = Reimburse.all
@project = Project.all
end
我想要这样的输出:
<tr>
<th >#</th>
<th >Date</th>
<th >Project name</th>
<th >Title</th>
<th >User name</th> #*this from table user*
<th >Status</th>
<th >Action</th>
</tr>