hi folks.
i want to check if a param exists if not to set it to a default value
for my date range filter. in my controller i have:
@from_date = Date.strptime(params[:startdate],"%d/%m/%Y")
@to_date = Date.strptime(params[:enddate],"%d/%m/%Y")
@articles = @results.find(:all,
:conditions => [ "created_at >= ? and
created_at <=?",@from_date,@to_date],
:order => ‘created_at desc’, :page => {:size
=> 5, :current => params[:page]})
this works as long as i have the params in the query string in the
address. but if i remmove them i want to be able to default to a date
range from today back a couple of months.
is there a param[:startdate].exists? check i can do???
any help asap would be great!!