# Can not search dynamically ! Please help

**URL:** <https://www.ruby-forum.com/t/can-not-search-dynamically-please-help/145542>\
**Category:** Rails\
**Created:** [August 11, 2008, 12:17pm UTC](https://www.ruby-forum.com/t/can-not-search-dynamically-please-help/145542 "2008-08-11T12:17:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dharmdip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@dharmdip](https://www.ruby-forum.com/u/dharmdip)\
**Post date:** [August 11, 2008, 12:17pm UTC](https://www.ruby-forum.com/t/can-not-search-dynamically-please-help/145542/1 "2008-08-11T12:17:36Z")

</div>

## hi ! i am having problem with , in brief i am trying to search particular posting by country wise . i have listed all country after clicking on particular country i want all posted jobs along with this country , i have this hard code it is searching only for specified country which is passed ! i want dynamic country searching .

def country\_list

```
 @postjob = Postjob.find(:all, :conditions => ["country ='india'"] )

```

end

* * *

i can search only posting which are from india ! i want this works  
dynamically .

please help !

---

<div class="post-metadata">

**Author:** ![dharmdip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@dharmdip](https://www.ruby-forum.com/u/dharmdip)\
**Post date:** [August 11, 2008, 12:25pm UTC](https://www.ruby-forum.com/t/can-not-search-dynamically-please-help/145542/2 "2008-08-11T12:25:38Z")

</div>

On 11 Aug 2008, at 11:17, Dharmdip R. wrote:

> ```
> @postjob = Postjob.find(:all, :conditions => ["country  
> 
> ```
> 
> =‘india’"] )
> 
> end

You want to have a quick look at rails’ condition handling stuff  
([Peak Obsession](http://api.rubyonrails.com/classes/ActiveRecord/Base.html)  
)

In a nutshell assuming a country parameter was being submitted you’d  
do something like

@postjobs = PostJob.find :all, :conditions =\> [“country=?”,  
params[:country]]  
or  
@postjobs = PostJob.find :all, :conditions =\> {:country=\>  
params[:country]}

Fred

---

<div class="post-metadata">

**Author:** ![dharmdip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e274bd/32.png) [@dharmdip](https://www.ruby-forum.com/u/dharmdip)\
**Post date:** [August 11, 2008, 12:57pm UTC](https://www.ruby-forum.com/t/can-not-search-dynamically-please-help/145542/3 "2008-08-11T12:57:04Z")

</div>

till i can not do this stuff !
