11155
(-- --)
1
I have a simple RESTful search scaffold that finds data in a separate
model and controller.
[code]
<h1>New search</h1>
<% form_for(@search) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :category_id %><br />
<%= f.collection_select :category_id, Category.all, :id, :name,
:include_blank => true %>
</p>
<p>
Age Range<br />
<%= f.text_field :minimum_age, :size => 3 %> -
<%= f.text_field :maximum_age, :size => 3 %>
</p>
<p>
<%= f.submit 'Create' %>
</p>
<% end %>
[/code]
I would like to require at least one parameter in the search, be it a
selected category, a minimum age, or a maximum age.
11155
(-- --)
2
Sean Six wrote:
I have a simple RESTful search scaffold that finds data in a separate
model and controller.
[code]
<h1>New search</h1>
<% form_for(@search) do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :category_id %><br />
<%= f.collection_select :category_id, Category.all, :id, :name,
:include_blank => true %>
</p>
<p>
Age Range<br />
<%= f.text_field :minimum_age, :size => 3 %> -
<%= f.text_field :maximum_age, :size => 3 %>
</p>
<p>
<%= f.submit 'Create' %>
</p>
<% end %>
[/code]
I would like to require at least one parameter in the search, be it a
selected category, a minimum age, or a maximum age.
Then write a custom validation method.
Best,