If I am right, when starting script/console (or script/server), models are not automatically required. But with you type MyModel.find(:first) in the console, it works. Is there any kind of method_missing implemented somewhere that does the require when console is feeded MyModel ? Thx Julien --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Yeah. ActiveSupport dependency checking in activesupport/lib/active_support/dependencies.rb In this case, it builds off of Module#const_missing. Jason On 5/31/07, bartocc <julien.palmas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > If I am right, when starting script/console (or script/server), models > are not automatically required. > > But with you type MyModel.find(:first) in the console, it works. Is > there any kind of method_missing implemented somewhere that does the > require when console is feeded MyModel ? > > Thx > Julien > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On May 31, 2007, at 2:40 PM, bartocc wrote:> If I am right, when starting script/console (or script/server), models > are not automatically required. > > But with you type MyModel.find(:first) in the console, it works. Is > there any kind of method_missing implemented somewhere that does the > require when console is feeded MyModel ?That''s it, the callback is called const_missing. That''s not something specific to the console, it is a Rails feature. Note that a typical Rails application does not need to require their controllers, models, helpers, ..., but you should in regular Ruby. That''s the reason. -- fxn --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---