Forum: Ruby on Rails Thorsten!!!! please understand me.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
87303c28b23af9aa69831b6bd156fdb0?d=identicon&s=25 Ruhul Amin (tuhin_cse99)
on 2007-02-20 12:34
Thorsten!!!!   please understand me.

Please read my query in the original post.

Amin
D7c511ce5025d37b8c6bd9134e0f2bd9?d=identicon&s=25 Thorsten (Guest)
on 2007-02-20 12:46
(Received via mailing list)
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 Amin <rails-mailing-l...@andreas-s.net>
87303c28b23af9aa69831b6bd156fdb0?d=identicon&s=25 Ruhul Amin (tuhin_cse99)
on 2007-02-20 12:56
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
D7c511ce5025d37b8c6bd9134e0f2bd9?d=identicon&s=25 Thorsten (Guest)
on 2007-02-20 13:03
(Received via mailing list)
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 Amin <rails-mailing-l...@andreas-s.net>
87303c28b23af9aa69831b6bd156fdb0?d=identicon&s=25 Ruhul Amin (tuhin_cse99)
on 2007-02-20 13:07
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 Amin <rails-mailing-l...@andreas-s.net>


Many many thanks Boss.....
have a nice time.

Amin
529a7c32966ebfe218bda288bd43898f?d=identicon&s=25 Guest (Guest)
on 2007-02-20 15:09
Sorry but this is so funny !!
This topic is locked and can not be replied to.