Is there a way to use the version of rails in /vendor from a standalone script? For example how would I make the following script work when the rails gems are not installed but only exist in /vendor? #!/usr/bin/env ruby require File.dirname(__FILE__) + "/config/environment" require ''rubygems'' require_gem ''activerecord'' require ''user'' users = User.find(:all) users.each do |user| puts user.class end _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Nov 1, 2005, at 2:37 PM, snacktime wrote:> Is there a way to use the version of rails in /vendor from a > standalone script? For example how would I make the following > script work when the rails gems are not installed but only exist > in /vendor? > > #!/usr/bin/env ruby > require File.dirname(__FILE__) + "/config/environment" > require ''rubygems'' > require_gem ''activerecord'' > require ''user'' > > users = User.find(:all) > users.each do |user| > puts user.class > end#!/usr/bin/env ruby require File.dirname(__FILE__) + ''/config/environment'' User.find(:all).each do |user| puts "Hello #{user.name}" end Rails automatically uses vendor/rails if present and falls back to RubyGems. jeremy -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (Darwin) iD8DBQFDZ/GiAQHALep9HFYRAuZ4AJ41KftfC/am7E9mx0jNWna/+YU5ygCePPLf 2N/11e6RS0p9SnCk63Vkjvo=vL5w -----END PGP SIGNATURE-----
> > > > On Nov 1, 2005, at 2:37 PM, snacktime wrote: > > Is there a way to use the version of rails in /vendor from a > > standalone script? For example how would I make the following > > script work when the rails gems are not installed but only exist > > in /vendor? > > > #!/usr/bin/env ruby > require File.dirname(__FILE__) + ''/config/environment'' > > User.find(:all).each do |user| > puts "Hello #{user.name <http://user.name>}" > end > > Rails automatically uses vendor/rails if present and falls back to > RubyGems.That was too easy...:) Thanks! Chris _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails