I''m trying to test functions in my models using the console. Should the code be in the model? I think so. I''m encapsulating find( ... :conditions=> ... However these functions aren''t available when I run the console. Am I missing something or is this ''by design''? -- life, n.: A whim of several billion cells to be you for a while. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi, you should be invoking the find method as follows: class_name.method_name e.g. Product.find( :all ) Good luck, -Conrad On 2/19/07, Anton Aylward <anton-XdPx9462FWc@public.gmane.org> wrote:> > I''m trying to test functions in my models using the console. > > Should the code be in the model? I think so. > I''m encapsulating > find( ... :conditions=> ... > > > However these functions aren''t available when I run the console. > > Am I missing something or is this ''by design''? > > -- > life, n.: > A whim of several billion cells to be you for a while. > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Conrad Taylor said the following on 02/19/2007 01:06 PM:> Hi, you should be invoking the find method as follows: > > class_name.method_nameThat *IS* what I was typing. In fact the console has a this neat trick whereby if you type the name of the class and a tab it will show the methods, or class_name.find<tab> and it will show you all the find methods for that class. I do this I I don''t see the methods I have defined in the model. a = Page.find_in<tab> and I don''t see the "find_in_book" that I defined in the model. -- Clear the battlefield and let me see All the profit from our victory. You talk of freedom, starving children poor. Are you deaf when you hear the season''s call? Were you there to watch the earth be scorched? Did you stand beside the spectral torch? Know the leaves of sorrow turned their face, Scattered on the ashes of disgrace. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Did you restart ./script/console ? On 2/19/07, Anton Aylward <anton-XdPx9462FWc@public.gmane.org> wrote:> > Conrad Taylor said the following on 02/19/2007 01:06 PM: > > Hi, you should be invoking the find method as follows: > > > > class_name.method_name > > That *IS* what I was typing. > > In fact the console has a this neat trick whereby if you type the name of > the class and a tab it will show the methods, or class_name.find<tab> and it > will show you all the find methods for that class. > > I do this I I don''t see the methods I have defined in the model. > > a = Page.find_in<tab> > > and I don''t see the "find_in_book" that I defined in the model. > > -- > Clear the battlefield and let me see > All the profit from our victory. > You talk of freedom, starving children poor. > Are you deaf when you hear the season''s call? > Were you there to watch the earth be scorched? > Did you stand beside the spectral torch? > Know the leaves of sorrow turned their face, > Scattered on the ashes of disgrace. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Yes. Ved Bew said the following on 02/19/2007 07:02 PM:> Did you restart ./script/console ? > > On 2/19/07, Anton Aylward <anton-XdPx9462FWc@public.gmane.org> wrote: >> Conrad Taylor said the following on 02/19/2007 01:06 PM: >>> Hi, you should be invoking the find method as follows: >>> >>> class_name.method_name >> That *IS* what I was typing. >> >> In fact the console has a this neat trick whereby if you type the name of >> the class and a tab it will show the methods, or class_name.find<tab> and it >> will show you all the find methods for that class. >> >> I do this I I don''t see the methods I have defined in the model. >> >> a = Page.find_in<tab> >> >> and I don''t see the "find_in_book" that I defined in the model.-- "How well we communicate is determined not by how well we say things but by how well we are understood." -- Andrew S. Grove. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---