# Find dynamic conditions?

**URL:** <https://www.ruby-forum.com/t/find-dynamic-conditions/105373>\
**Category:** Rails\
**Created:** [May 29, 2007, 12:26pm UTC](https://www.ruby-forum.com/t/find-dynamic-conditions/105373 "2007-05-29T12:26:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/35a633/32.png) [@jamal](https://www.ruby-forum.com/u/jamal)\
**Post date:** [May 29, 2007, 12:26pm UTC](https://www.ruby-forum.com/t/find-dynamic-conditions/105373/1 "2007-05-29T12:26:20Z")

</div>

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 😃
