# Thorsten! please understand me

**URL:** <https://www.ruby-forum.com/t/thorsten-please-understand-me/86175>\
**Category:** Rails\
**Created:** [February 20, 2007, 12:34pm UTC](https://www.ruby-forum.com/t/thorsten-please-understand-me/86175 "2007-02-20T12:34:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tuhin\_cse99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a6a055/32.png) [@tuhin\_cse99](https://www.ruby-forum.com/u/tuhin_cse99)\
**Post date:** [February 20, 2007, 12:34pm UTC](https://www.ruby-forum.com/t/thorsten-please-understand-me/86175/1 "2007-02-20T12:34:26Z")

</div>

Thorsten!!! please understand me.

Please read my query in the original post.

Amin

---

<div class="post-metadata">

**Author:** ![tuhin\_cse99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a6a055/32.png) [@tuhin\_cse99](https://www.ruby-forum.com/u/tuhin_cse99)\
**Post date:** [February 20, 2007, 12:46pm UTC](https://www.ruby-forum.com/t/thorsten-please-understand-me/86175/2 "2007-02-20T12:46:20Z")

</div>

Dude, are you crazy?

Please stop flooding the mailing list with useless requests. and don’t  
try to pressure me.

Don’t think many people will be willing to help oyu if you act that  
rude, me included if you continue like that.

On 20 Feb., 12:34, Ruhul A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![tuhin\_cse99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a6a055/32.png) [@tuhin\_cse99](https://www.ruby-forum.com/u/tuhin_cse99)\
**Post date:** [February 20, 2007, 1:03pm UTC](https://www.ruby-forum.com/t/thorsten-please-understand-me/86175/3 "2007-02-20T13:03:21Z")

</div>

cond = params[:movie][:name] + “%” #i hope you have a “name” field in  
your search form?

@report = Movie.find :all, :conditions =\> [‘name like ?’,cond]

Stop using find\_by\_sql.You should almost never be in need to use it.  
ActiveRecord offers better ways

On 20 Feb., 12:56, Ruhul A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![tuhin\_cse99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a6a055/32.png) [@tuhin\_cse99](https://www.ruby-forum.com/u/tuhin_cse99)\
**Post date:** [February 20, 2007, 12:56pm UTC](https://www.ruby-forum.com/t/thorsten-please-understand-me/86175/4 "2007-02-20T12:56:14Z")

</div>

Sorry for that. Please don’t angry with me. I am new in Ruby.

My main missionis to search a movie by it name. so please tell me  
how can i use write the sql query using “like”

suppose i want to search all movie whose name begin with mission

select \*from movies where name like ‘mission%’

so what will be the following two lines?

query = "select \* from movies where name like ?  
"  
@report = Movie.find\_by\_sql([query, params[:movie][:id]])

Thanks in advanced

Amin

---

<div class="post-metadata">

**Author:** ![tuhin\_cse99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a6a055/32.png) [@tuhin\_cse99](https://www.ruby-forum.com/u/tuhin_cse99)\
**Post date:** [February 20, 2007, 3:09pm UTC](https://www.ruby-forum.com/t/thorsten-please-understand-me/86175/5 "2007-02-20T15:09:19Z")

</div>

Sorry but this is so funny !!

---

<div class="post-metadata">

**Author:** ![tuhin\_cse99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a6a055/32.png) [@tuhin\_cse99](https://www.ruby-forum.com/u/tuhin_cse99)\
**Post date:** [February 20, 2007, 1:07pm UTC](https://www.ruby-forum.com/t/thorsten-please-understand-me/86175/6 "2007-02-20T13:07:59Z")

</div>

Thorsten wrote:

> cond = params[:movie][:name] + “%” #i hope you have a “name” field in  
> your search form?
> 
> @report = Movie.find :all, :conditions =\> [‘name like ?’,cond]
> 
> Stop using find\_by\_sql.You should almost never be in need to use it.  
> ActiveRecord offers better ways
> 
> On 20 Feb., 12:56, Ruhul A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Many many thanks Boss…  
have a nice time.

Amin
