I''ve written a simple replacement (not extension) of Ruby''s array class with some added functionality. I defined it in array.rb and put the file in rails_root/lib but when i fire up the console the class isn''t being loaded. How can I have my class automatically loaded and used instead of the built in Ruby class?
Why would you want to replace the built-in Array class .... that seems like a bad idea to me. Just extend the built-in class in environment.rb if you want more functionality. -Jonathan. On 6/25/06, Alan Bullock <liststuff@gmail.com> wrote:> I''ve written a simple replacement (not extension) of Ruby''s array class with > some added functionality. I defined it in array.rb and put the file in > rails_root/lib but when i fire up the console the class isn''t being loaded. > How can I have my class automatically loaded and used instead of the built > in Ruby class? > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
> On 6/25/06, Alan Bullock <liststuff@gmail.com> wrote: >> I''ve written a simple replacement (not extension) of Ruby''s array class >> with >> some added functionality. I defined it in array.rb and put the file in >> rails_root/lib but when i fire up the console the class isn''t being loaded. >> How can I have my class automatically loaded and used instead of the built >> in Ruby class? > > > Why would you want to replace the built-in Array class .... that seems > like a bad idea to me. > > Just extend the built-in class in environment.rb if you want more > functionality.Or leave it in lib, but require it in environment.rb..... but I agree about the extension vs. replacement.