Hi, I was wondering if it is possible to reload your model code on the console, without having to exit (or reload the whole environment for that matter) Anyone an idea? Cheers! Flurin
you can try to just call load("filename.rb") On Tue, 18 Jan 2005 10:39:38 +0100, F. Egger <f.egger.mailings-c2BlD8dJSIudKNnQ2JlF7Q@public.gmane.org> wrote:> Hi, > > I was wondering if it is possible to reload your model code on the > console, without having to exit (or reload the whole environment for > that matter) > > Anyone an idea? > > Cheers! > Flurin > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Tobi http://www.hieraki.org - Open source book authoring http://blog.leetsoft.com - Technical weblog
Is there a general ruby solution to this? I quite often whip open an irb session to play around with the libraries I''ve been using. Typically I do: $ irb irb(main):001:0> require ''some_lib'' irb(main):002:0> # do tests, notice bug, save new version ^D On Tue, 18 Jan 2005 17:09:07 -0500, Tobias Luetke <tobias.luetke-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> you can try to just call load("filename.rb") > > On Tue, 18 Jan 2005 10:39:38 +0100, F. Egger > <f.egger.mailings-c2BlD8dJSIudKNnQ2JlF7Q@public.gmane.org> wrote: > > Hi, > > > > I was wondering if it is possible to reload your model code on the > > console, without having to exit (or reload the whole environment for > > that matter) > > > > Anyone an idea? > > > > Cheers! > > Flurin > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > -- > Tobi > http://www.hieraki.org - Open source book authoring > http://blog.leetsoft.com - Technical weblog > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Cheers Koz
On Wed, Jan 19, 2005 at 12:49:05PM +1300, Michael Koziarski wrote:> Is there a general ruby solution to this? > > I quite often whip open an irb session to play around with the > libraries I''ve been using. Typically I do: > > $ irb > irb(main):001:0> require ''some_lib'' > irb(main):002:0> # do tests, notice bug, save new version > ^D > > > On Tue, 18 Jan 2005 17:09:07 -0500, Tobias Luetke > <tobias.luetke-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > you can try to just call load("filename.rb") > > > > On Tue, 18 Jan 2005 10:39:38 +0100, F. Egger > > <f.egger.mailings-c2BlD8dJSIudKNnQ2JlF7Q@public.gmane.org> wrote: > > > Hi, > > > > > > I was wondering if it is possible to reload your model code on the > > > console, without having to exit (or reload the whole environment for > > > that matter)"Is there a general ruby solution to this?" Kernel#load (what Tobias mentioned) is a ruby method. For those familiar with python, require is to load as import is to reload. marcel -- Marcel Molina Jr. <marcel-WRrfy3IlpWYdnm+yROfE0A@public.gmane.org>
Okay, load works find If you programm some_lib, but load doesn''t seem to work in combination with Rails. When doing load ''model'' it just gives an error about not being able to find ''model.rb''. It would be nice if you could say: reload_model :model and reload_all_models or something like that. Marcel Molina Jr. wrote:>On Wed, Jan 19, 2005 at 12:49:05PM +1300, Michael Koziarski wrote: > > >>Is there a general ruby solution to this? >> >>I quite often whip open an irb session to play around with the >>libraries I''ve been using. Typically I do: >> >>$ irb >>irb(main):001:0> require ''some_lib'' >>irb(main):002:0> # do tests, notice bug, save new version >>^D >> >> >>On Tue, 18 Jan 2005 17:09:07 -0500, Tobias Luetke >><tobias.luetke-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> >>>you can try to just call load("filename.rb") >>> >>>On Tue, 18 Jan 2005 10:39:38 +0100, F. Egger >>><f.egger.mailings-c2BlD8dJSIudKNnQ2JlF7Q@public.gmane.org> wrote: >>> >>> >>>>Hi, >>>> >>>>I was wondering if it is possible to reload your model code on the >>>>console, without having to exit (or reload the whole environment for >>>>that matter) >>>> >>>> > >"Is there a general ruby solution to this?" > >Kernel#load (what Tobias mentioned) is a ruby method. For those familiar >with python, require is to load as import is to reload. > >marcel > >
On Wed, Jan 19, 2005 at 06:40:59PM +0100, F. Egger wrote:> Okay, load works find If you programm some_lib, but load doesn''t seem to > work in combination with Rails. > When doing load ''model'' it just gives an error about not being able to > find ''model.rb''. > > It would be nice if you could say: > reload_model :model > and > reload_all_models > > or something like that.I was only responding to the issue of reloading something in irb. Rails provides ''require_dependency'' and ''require_association'' which deals with reloading when the reloading option is turned on in the environment file. Whether or not it does what it''s expected to do all the time might not yet be the case. But that is the plan.> >On Wed, Jan 19, 2005 at 12:49:05PM +1300, Michael Koziarski wrote: > > > > > >>Is there a general ruby solution to this? > >> > >>I quite often whip open an irb session to play around with the > >>libraries I''ve been using. Typically I do: > >> > >>$ irb > >>irb(main):001:0> require ''some_lib'' > >>irb(main):002:0> # do tests, notice bug, save new version > >>^D > >> > >> > >>On Tue, 18 Jan 2005 17:09:07 -0500, Tobias Luetke > >><tobias.luetke-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> > >> > >>>you can try to just call load("filename.rb") > >>> > >>>On Tue, 18 Jan 2005 10:39:38 +0100, F. Egger > >>><f.egger.mailings-c2BlD8dJSIudKNnQ2JlF7Q@public.gmane.org> wrote: > >>> > >>> > >>>>Hi, > >>>> > >>>>I was wondering if it is possible to reload your model code on the > >>>>console, without having to exit (or reload the whole environment for > >>>>that matter) > >>>> > >>>> > > > >"Is there a general ruby solution to this?" > > > >Kernel#load (what Tobias mentioned) is a ruby method. For those familiar > >with python, require is to load as import is to reload. > > > >marcel > > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Marcel Molina Jr. <marcel-WRrfy3IlpWYdnm+yROfE0A@public.gmane.org>
Try load ''model.rb'' F. Egger wrote:> Okay, load works find If you programm some_lib, but load doesn''t seem > to work in combination with Rails. > When doing load ''model'' it just gives an error about not being able to > find ''model.rb''. > > It would be nice if you could say: > reload_model :model > and > reload_all_models > > or something like that. > > Marcel Molina Jr. wrote: > >> On Wed, Jan 19, 2005 at 12:49:05PM +1300, Michael Koziarski wrote: >> >> >>> Is there a general ruby solution to this? >>> >>> I quite often whip open an irb session to play around with the >>> libraries I''ve been using. Typically I do: >>> >>> $ irb >>> irb(main):001:0> require ''some_lib'' >>> irb(main):002:0> # do tests, notice bug, save new version >>> ^D >>> >>> On Tue, 18 Jan 2005 17:09:07 -0500, Tobias Luetke >>> <tobias.luetke-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> >>> >>>> you can try to just call load("filename.rb") >>>> >>>> On Tue, 18 Jan 2005 10:39:38 +0100, F. Egger >>>> <f.egger.mailings-c2BlD8dJSIudKNnQ2JlF7Q@public.gmane.org> wrote: >>>> >>>> >>>>> Hi, >>>>> >>>>> I was wondering if it is possible to reload your model code on the >>>>> console, without having to exit (or reload the whole environment for >>>>> that matter) >>>>> >>>> >> >> "Is there a general ruby solution to this?" >> >> Kernel#load (what Tobias mentioned) is a ruby method. For those familiar >> with python, require is to load as import is to reload. >> >> marcel >> >> > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Most unfortunately doesn''t work as load somehow has another "loadpath" then require... Dominic Sisneros wrote:> Try > load ''model.rb'' > > F. Egger wrote: > >> Okay, load works find If you programm some_lib, but load doesn''t seem >> to work in combination with Rails. >> When doing load ''model'' it just gives an error about not being able >> to find ''model.rb''. >> >> It would be nice if you could say: >> reload_model :model >> and >> reload_all_models >> >> or something like that. >> >> Marcel Molina Jr. wrote: >> >>> On Wed, Jan 19, 2005 at 12:49:05PM +1300, Michael Koziarski wrote: >>> >>> >>>> Is there a general ruby solution to this? >>>> >>>> I quite often whip open an irb session to play around with the >>>> libraries I''ve been using. Typically I do: >>>> >>>> $ irb >>>> irb(main):001:0> require ''some_lib'' >>>> irb(main):002:0> # do tests, notice bug, save new version >>>> ^D >>>> >>>> On Tue, 18 Jan 2005 17:09:07 -0500, Tobias Luetke >>>> <tobias.luetke-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>> >>>> >>>>> you can try to just call load("filename.rb") >>>>> >>>>> On Tue, 18 Jan 2005 10:39:38 +0100, F. Egger >>>>> <f.egger.mailings-c2BlD8dJSIudKNnQ2JlF7Q@public.gmane.org> wrote: >>>>> >>>>> >>>>>> Hi, >>>>>> >>>>>> I was wondering if it is possible to reload your model code on the >>>>>> console, without having to exit (or reload the whole environment for >>>>>> that matter) >>>>>> >>>>> >>>>> >>> >>> "Is there a general ruby solution to this?" >>> >>> Kernel#load (what Tobias mentioned) is a ruby method. For those >>> familiar >>> with python, require is to load as import is to reload. >>> >>> marcel >>> >>> >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
It should work. Require is just like load but it checks the loadpath and fails if its already loaded. On Thu, 20 Jan 2005 08:38:36 +0100, F. Egger <f.egger.mailings-c2BlD8dJSIudKNnQ2JlF7Q@public.gmane.org> wrote:> Most unfortunately doesn''t work as load somehow has another "loadpath" > then require... > > Dominic Sisneros wrote: > > > Try > > load ''model.rb'' > > > > F. Egger wrote: > > > >> Okay, load works find If you programm some_lib, but load doesn''t seem > >> to work in combination with Rails. > >> When doing load ''model'' it just gives an error about not being able > >> to find ''model.rb''. > >> > >> It would be nice if you could say: > >> reload_model :model > >> and > >> reload_all_models > >> > >> or something like that. > >> > >> Marcel Molina Jr. wrote: > >> > >>> On Wed, Jan 19, 2005 at 12:49:05PM +1300, Michael Koziarski wrote: > >>> > >>> > >>>> Is there a general ruby solution to this? > >>>> > >>>> I quite often whip open an irb session to play around with the > >>>> libraries I''ve been using. Typically I do: > >>>> > >>>> $ irb > >>>> irb(main):001:0> require ''some_lib'' > >>>> irb(main):002:0> # do tests, notice bug, save new version > >>>> ^D > >>>> > >>>> On Tue, 18 Jan 2005 17:09:07 -0500, Tobias Luetke > >>>> <tobias.luetke-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >>>> > >>>> > >>>>> you can try to just call load("filename.rb") > >>>>> > >>>>> On Tue, 18 Jan 2005 10:39:38 +0100, F. Egger > >>>>> <f.egger.mailings-c2BlD8dJSIudKNnQ2JlF7Q@public.gmane.org> wrote: > >>>>> > >>>>> > >>>>>> Hi, > >>>>>> > >>>>>> I was wondering if it is possible to reload your model code on the > >>>>>> console, without having to exit (or reload the whole environment for > >>>>>> that matter) > >>>>>> > >>>>> > >>>>> > >>> > >>> "Is there a general ruby solution to this?" > >>> > >>> Kernel#load (what Tobias mentioned) is a ruby method. For those > >>> familiar > >>> with python, require is to load as import is to reload. > >>> > >>> marcel > >>> > >>> > >> > >> _______________________________________________ > >> Rails mailing list > >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >> http://lists.rubyonrails.org/mailman/listinfo/rails > >> > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Tobi http://www.hieraki.org - Open source book authoring http://blog.leetsoft.com - Technical weblog
That''s weird, when I do require ''modelname'' it returns true (so this works) but load ''modelname'' raises an exception: LoadError: No such file to load -- modelname Any thoughts on that? Tobias Luetke wrote:>It should work. > >Require is just like load but it checks the loadpath and fails if its >already loaded. > > >On Thu, 20 Jan 2005 08:38:36 +0100, F. Egger ><f.egger.mailings-c2BlD8dJSIudKNnQ2JlF7Q@public.gmane.org> wrote: > > >>Most unfortunately doesn''t work as load somehow has another "loadpath" >>then require... >> >>Dominic Sisneros wrote: >> >> >> >>>Try >>>load ''model.rb'' >>> >>>F. Egger wrote: >>> >>> >>> >>>>Okay, load works find If you programm some_lib, but load doesn''t seem >>>>to work in combination with Rails. >>>>When doing load ''model'' it just gives an error about not being able >>>>to find ''model.rb''. >>>> >>>>It would be nice if you could say: >>>> reload_model :model >>>>and >>>> reload_all_models >>>> >>>>or something like that. >>>> >>>>Marcel Molina Jr. wrote: >>>> >>>> >>>> >>>>>On Wed, Jan 19, 2005 at 12:49:05PM +1300, Michael Koziarski wrote: >>>>> >>>>> >>>>> >>>>> >>>>>>Is there a general ruby solution to this? >>>>>> >>>>>>I quite often whip open an irb session to play around with the >>>>>>libraries I''ve been using. Typically I do: >>>>>> >>>>>>$ irb >>>>>>irb(main):001:0> require ''some_lib'' >>>>>>irb(main):002:0> # do tests, notice bug, save new version >>>>>>^D >>>>>> >>>>>>On Tue, 18 Jan 2005 17:09:07 -0500, Tobias Luetke >>>>>><tobias.luetke-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>>>you can try to just call load("filename.rb") >>>>>>> >>>>>>>On Tue, 18 Jan 2005 10:39:38 +0100, F. Egger >>>>>>><f.egger.mailings-c2BlD8dJSIudKNnQ2JlF7Q@public.gmane.org> wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>>Hi, >>>>>>>> >>>>>>>>I was wondering if it is possible to reload your model code on the >>>>>>>>console, without having to exit (or reload the whole environment for >>>>>>>>that matter) >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>"Is there a general ruby solution to this?" >>>>> >>>>>Kernel#load (what Tobias mentioned) is a ruby method. For those >>>>>familiar >>>>>with python, require is to load as import is to reload. >>>>> >>>>>marcel >>>>> >>>>> >>>>> >>>>> >>>>_______________________________________________ >>>>Rails mailing list >>>>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>>http://lists.rubyonrails.org/mailman/listinfo/rails >>>> >>>> >>>> >>>_______________________________________________ >>>Rails mailing list >>>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>http://lists.rubyonrails.org/mailman/listinfo/rails >>> >>> >>_______________________________________________ >>Rails mailing list >>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >> > > > >
On Fri, Jan 21, 2005 at 08:44:50PM +0100, F. Egger wrote:> That''s weird, when I do > > require ''modelname'' > > it returns true (so this works) but > > load ''modelname'' > > raises an exception: LoadError: No such file to load -- modelname > > Any thoughts on that?load requires the file extension... so load ''modelname.rb'' marcel -- Marcel Molina Jr. <marcel-WRrfy3IlpWYdnm+yROfE0A@public.gmane.org>
Ah there we go :) Thanks! Marcel Molina Jr. wrote:>On Fri, Jan 21, 2005 at 08:44:50PM +0100, F. Egger wrote: > > >>That''s weird, when I do >> >>require ''modelname'' >> >>it returns true (so this works) but >> >>load ''modelname'' >> >>raises an exception: LoadError: No such file to load -- modelname >> >>Any thoughts on that? >> >> > >load requires the file extension... so load ''modelname.rb'' > >marcel > >