kalau untuk perintah query buat nyari, saya menyarankan pake gem searchlogic, ga ribet, ga perlu pake sequel.
example nya jadi gini Nation.country_like(params[:ctr_id]). atau Product.code_number_equals(params[:ctr_id]) lebih enak. bisa dilihat di railscast nya, di http://railscasts.com/episodes/176-searchlogic On Nov 13, 2009, at 9:32 AM, Widi Harsojo wrote: > coba sequel... saya pakai sequel di rails dan untuk find ex: > Nation.where("country like '#{params[:ctr_id]}%'").all > konsep nya simple DB, Data, atau Model > Result set ORM(bisa di convert ke array hash) atau array hash. > > 2009/11/13 Adinda Praditya <[email protected]> > >> >> >> Makasih atas tanggapan2nya. Code apa ya..? Cuman find biasa aja >> kok. Dan di >> model yang lain biasa2 aja. Awalnya saya jalanin >> find_all_by_country dan >> muncul jenis error yang sama. Setelah chat dan disaranin untuk coba >> ini itu >> nggak bisa, saya jalanin find biasa seperti ini >> >> self.find(:all, :conditions => {:country => self.country}) >> >> Tetap nggak bisa. Googling juga dapetnya 'find_all' yang katanya udah >> deprecated. Apa masih ada orang yg biasa chat di #rubyonrails >> Freenode? >> >> Dida >> >> 2009/11/13 Rafeequl Rahman <[email protected] <rafeequl >> %40gmail.com>> >> >> >>> menarik juga, kebetulan saya 10.6.2 , boleh share code snippets >>> dan/atau >>> log >>> >>> On Nov 12, 2009, at 7:31 PM, Arie Kusuma Atmaja wrote: >>> >>>> 2009/11/12 Adinda Praditya <[email protected]<apraditya >>>> %40gmail.com> >>> : >>>> >>>>> Saya dapet NoMethodError saat menjalankan find method dari model >>> seperti >>>>> ini: >>>>> >>>>> undefined method `find' for #<User:0x1034331a0> >>>>> >>>>> Padahal find adalah class method dari rails. Error ini dari web, >>>>> tapi >>> kalo >>>>> saya jalanin dari rails console, normal tanpa error. Ada yang >>>>> pernah >>> ngalami >>>>> hal ini? Apa yang harus saya periksa? Aplikasi saya berada di atas >>> frozen >>>>> rails 2.3.4 on OSX 10.6.2, ruby 1.8.7 patchlevel 174. >>>> >>>> Hmm.. aneh.. dan menarik.. >>>> >>>>>> User.respond_to? 'find' >>>> => true >>>> >>>>>> User.methods.include? "find" >>>> => true >>>> >>>> saya pribadi belum pernah pakai OSX 10.6.2 , saya pakai yg OSX >>>> 10.5.8 >>>> , Probably other Snow Leopard users could help / I saw Michael's >>>> MacBook Pro was using Snow Leopard but he never complained about >>>> it. >>>> >>>> D'oh! http://en.wikipedia.org/wiki/D'oh< >> http://en.wikipedia.org/wiki/D%27oh> >> >>> ! >>>> >>> >>> >> >> [Non-text portions of this message have been removed] >> >> >> > > > > -- > /wh > > e=mc2inhologram > > > [Non-text portions of this message have been removed] > > > > ------------------------------------ > > ID-Ruby > Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk > segala varian Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program > yang dibuat dengan Ruby (Ruby on Rails, JRuby on Rails, Merb) > > http://rubyurl.com/Q8DD > http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia > > > >

