Re: [Rails] Verify presence_of parameter

2010-02-15 Thread Colin Law
On 15 February 2010 03:07, Sean Six li...@ruby-forum.com wrote: I would like to verify a parameter is present before a search is posted. min_age = params[:min_age]  max_age = params[:max_age] @users = User.find(:all,                  :conditions = [years = ? AND years = ? min_age,

Re: [Rails] Verify presence_of parameter

2010-02-15 Thread Michael Pavling
On 15 February 2010 03:07, Sean Six li...@ruby-forum.com wrote: I tried this: min_age = params[:min_age]  max_age = params[:max_age]  if max_age.nil?   flash[:notice] = please enter max age! If there is a field called max_age on the form, but the user leaves it blank, you won't get nil from

[Rails] Verify presence_of parameter

2010-02-14 Thread Sean Six
I would like to verify a parameter is present before a search is posted. min_age = params[:min_age] max_age = params[:max_age] @users = User.find(:all, :conditions = [years = ? AND years = ? min_age, max_age]) Basically I am just concerned about the max_age. I tried this: