Find dynamic conditions?


#1

Hello there,

I have a little problem with the find, I want to put some conditions
depend on the users want.

#Language
if params[:l].to_i > 0
find_options[:conditions] = [“language_id = ?”, params[:l]]
end

#Category
if params[:c].to_i > 0
find_options[:conditions] = [“category_id = ?”, params[:c]]
end

@videos = VideoBrowse.find(:all, :conditions =>
find_options[:conditions] , :include => [:category, :language, :user])

Is there a better way to do it then this?

and thanks for help :smiley: