Thorsten!!!! please understand me. Please read my query in the original post. Amin -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Thorsten!!!! please understand me. > > Please read my query in the original post. > > Amin > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> 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 > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>Many many thanks Boss..... have a nice time. Amin -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sorry but this is so funny !! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---