Phlip wrote: > Cynthia Kiser wrote: > >> require File.expand_path(File.dirname(__FILE__) + "/../config/environment") >> require 'test_help' >> require 'factory' > > I thought newer Railses reduced their file lookup paths. Use the > dirname(__FILE__) trick you see right above your factory! > > > require File.expand_path(File.dirname(__FILE__) + "/../factory.rb") > > Alternately, use RAILS_ROOT, because environment.rb sets that. > > -- > Phlip
Why does it fail to find 'factory.rb', though? Shouldn't a 'require', written in file A, find a co-located file B, regardless of the loadpath? It may be desirable to avoid the RAILS_ROOT and __FILE__ versions of 'require' to avoid loading the file multiple times, unnecessarily. For example, you might get warnings about 'redefined' constants. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

