Ruby Rhomobile:没有从表单中发布参数
我想用一个简单的表单来搜索姓氏:Ruby Rhomobile:没有从表单中发布参数,ruby,rhomobile,rhodes,Ruby,Rhomobile,Rhodes,我想用一个简单的表单来搜索姓氏: <form method="POST" action="<%= url_for :action => :index %>"> <label for="surname" class="itemLabel">Search Surname</label> <input type="text" id="surname" name="surname" class="" <%= placeholder
<form method="POST" action="<%= url_for :action => :index %>">
<label for="surname" class="itemLabel">Search Surname</label>
<input type="text" id="surname" name="surname" class="" <%= placeholder("Surname") %> />
<input type="submit" value="Search"/>
</form>
如果它有一个姓param,那么它会搜索,如果没有,它只会显示所有可用的。当我调试此操作时,在发布搜索表单后调用它时,我从未看到任何参数
这个搜索表单是基于自动生成的登录表单(有效),所以我有点困惑。有什么想法吗?尝试在控制器中发布不同的操作,或者将索引操作重命名为类似[model]\u index的内容 Rhodes似乎喜欢处理传递给索引操作的查询参数 我使用您的代码运行了一个快速测试,如果您将控制器方法更改为“index_new”,参数将成功传递
def index
if @params['surname'].nil? or @params['surname'].empty?
@fencers = Fencer.find(:all)
else
@fencers = Fencer.find(:all, :conditions => {:surname => @params['surname']})
end
render :back => '/app'
end