Hi, Suppose I want to redefine the Ruby String class in a Rails app. In which file is it the most suitable to write the redefinition? Thanks Guillaume Carbonneau -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060816/5b0da204/attachment.html
any file ...... as long its visible to your application and require for that file returns true for example you have a file called thisfile.rb all you have to do in that file is class String def yourMethod #do something end end and wherever you need it just do this require ''thisfile'' -daya On 8/16/06, Guillaume Carbonneau <gusxedge@gmail.com> wrote:> > Hi, > > Suppose I want to redefine the Ruby String class in a Rails app. In which > file is it the most suitable to write the redefinition? > > Thanks > > Guillaume Carbonneau > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060817/0fdf6d2e/attachment.html
...and "thisfile.rb" should go into the model, controller or helpers folder? Guillaume Carbonneau On 8/16/06, linux user <fanoflinux@gmail.com> wrote:> > any file ...... as long its visible to your application and require for > that file returns true > > for example you have a file called thisfile.rb > > all you have to do in that file is > > class String > def yourMethod > #do something > end > end > > and wherever you need it just do this > > require ''thisfile'' > > -daya > > On 8/16/06, Guillaume Carbonneau < gusxedge@gmail.com> wrote: > > > Hi, > > Suppose I want to redefine the Ruby String class in a Rails app. In which > file is it the most suitable to write the redefinition? > > Thanks > > Guillaume Carbonneau > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060817/8684d299/attachment.html
ok thanks. Another question... once I start my Webrick server, the String class gets redefined well the first time but all subsequent changes goes unnoticed by the requests. I have to restart my webserver.. Why is this happening? Is there a way to avoid it? Guillaume Carbonneau On 8/16/06, Max Muermann <ruby@muermann.org> wrote:> > lib > > Max > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060817/f213bff6/attachment.html
never got an answer anyone? On 8/16/06, Guillaume Carbonneau <gusxedge@gmail.com> wrote:> > ok thanks. > > Another question... once I start my Webrick server, the String class gets > redefined well the first time but all subsequent changes goes unnoticed by > the requests. I have to restart my webserver.. > > Why is this happening? > Is there a way to avoid it? > > Guillaume Carbonneau > > > On 8/16/06, Max Muermann <ruby@muermann.org> wrote: > > > > lib > > > > Max > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060902/9ae49a4f/attachment.html