Hi You don't do find on an instance of the model, you do it on the model itself. So your find should be
Stuff.find( :all, :select => 'mp1') Simon On Wed, 08 Jul 2009 07:00:47 +0800, Mark Preston <[email protected]> wrote: > > Newbie question, trying to get data from a mysql database. I can write > to it fine, but when I try to retrieve it I get the following error > message: > > C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/attribute_methods.rb:260:in > `method_missing': undefined method `find' for #<Stuff id: nil, mp1: nil, > mp2: nil> (NoMethodError) > > from C:/rubyapps/stuff/lib/get.rb:16:in `m' > > from C:/rubyapps/stuff/lib/get.rb:10:in `initialize' > > from C:/rubyapps/stuff/lib/get.rb:22:in `new' > > from C:/rubyapps/stuff/lib/get.rb:22 > > > This is the code below. > > Thanks for your help > > > require 'environment' > require 'rubygems' > require 'Stuff' > > > class Get > > def initialize > > m > end > > def m > @mystuff =Stuff.new > > b = @mystuff.find( :all, :select => 'mp1') > puts "mp1 has the following values: #{b}" > > end > end > > Get.new --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

