RAILS_ROOT path definition

testing my app locally I have no problem, but now I try to test it with
my ISP (Bluehost)

and I have a problem with a path definition of a file I need to read
initially in my application.rb

def geo_from_IP
geo_ip = GeoIP.new("#{RAILS_ROOT}/data/GeoIPCityfr.dat")

raises an error : no such file to load – geoip

the file exists actually and is located at :

my_home/ rails> myapp > data > GeoIPCityfr.dat

how and where RAILS_ROOT should it be defined ?

Note :
as usal in ISP configuration, I have a link to myapp:

my_home / public_html > myapp ( link_to user_home/ rails> myapp )

Kad K. wrote:

raises an error : no such file to load – geoip
my_home / public_html > myapp ( link_to user_home/ rails> myapp )

Hey

from

no such file to load – geoip

I get the idea that GeoIP hasn’t been ‘required’?

Hope this helps…
Gustav P.
[email protected]

Gustav P. wrote:

Kad K. wrote:

raises an error : no such file to load – geoip
my_home / public_html > myapp ( link_to user_home/ rails> myapp )

Hey

from

no such file to load – geoip

I get the idea that GeoIP hasn’t been ‘required’?

Hope this helps…
Gustav P.
[email protected]

thanks Gustav…

yes it has been required… the application.rb at my ISP is the same
as the one I run locally (localhost) and it runs very well here… the
only difference is the remote ISP installation , with this f… link I
wrote to get it running :

cd ~/public_html/
ln -s /home/myusername/rails/myapp/public myapp

I tried to write at the beginning of my environment.rb
RAILS_ROOT = ‘/home/myusername/rails/pdm/’

but still I cannot read the GeoIP file

Gustav P. wrote:

Kad K. wrote:

raises an error : no such file to load – geoip
my_home / public_html > myapp ( link_to user_home/ rails> myapp )

Hey

from

no such file to load – geoip

I get the idea that GeoIP hasn’t been ‘required’?

Hope this helps…
Gustav P.
[email protected]

Well Well I was thinking again about your remark !!.. thanks…
GeoIP was installed locally using gem… and I belive that my ISP
installation doesn’t have it …
is there any way to put it in my app ? (I am new to Rails…)

kad

Kad K. wrote:

Hey

I tried to write at the beginning of my environment.rb
RAILS_ROOT = ‘/home/myusername/rails/pdm/’

but still I cannot read the GeoIP file

The gem should have a dir in
/usr/lib/ruby/gems/1.8/gems/
(atleast, that’s where I found mine, I’m a linux newbie though, so maybe
you pro’s keep your stuff elsewhere :] )

there should be a /lib directory in there with either one .rb file (if
you’re lucky) or more than one, or (as in the case of the JSON gem which
I did this with earlier) one .rb which required a bunch of others in a
lib/some_dir/ subdirectory…

Either, you should be able to just copy all the contents of the lib,
paste them in RAILS_ROOT/lib/ and require them in environment.rb (or
some similar file like application.rb maybe?). (in the case of the json
gem, I needed only require the outermost one, it required the ones in
the subdirectory by itself)

I hope this helps,

Cheery-o
Gustav P.
[email protected]

Either, you should be able to just copy all the contents of the lib,
paste them in RAILS_ROOT/lib/ and require them in environment.rb (or
some similar file like application.rb maybe?). (in the case of the json
gem, I needed only require the outermost one, it required the ones in
the subdirectory by itself)

Either way, sorry for the bad English!
Gustav