Hello!
I have a Rails application, and now I'm trying to make a cgi-script
out of Rails, but it should operate with Rails database and models.
Problem 1.
Next script doesn't seem to work everywhere:
require 'rubygems'
gem 'activerecord', '=2.1.0'
require 'active_record'
require 'yaml'
ActiveRecord::Base.establish_connection( YAML.load_file("config/
database.yml")['development'] )
It works perfectly from console, but I cannot force it to work as a
web page. It gives me "500 Internal error" page, and Apache log says
me:
[error] mod_ruby: error in ruby
[error] mod_ruby: /usr/local/lib/site_ruby/1.8/rubygems/
custom_require.rb:32:in `gem_original_require': no such file to load
-- active_record (LoadError)
[error] mod_ruby: from /usr/local/lib/site_ruby/1.8/rubygems/
custom_require.rb:32:in `require'
[error] mod_ruby: from /var/www/pc/api.rbx:6
[error] mod_ruby: from /usr/lib/ruby/1.8/apache/ruby-run.rb:53:in
`load'
[error] mod_ruby: from /usr/lib/ruby/1.8/apache/ruby-run.rb:53:in
`handler'
My configuration:
Ubuntu 7.10
Apache 2.2.4 + mod_ruby + mod_fcgid
Ruby 1.8.6
Rails 2.1.0
Problem 2.
One of my models "acts as tree" in the Rails application. But how can
I make it to work in my cgi-script?
I have tried:
require 'vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb'
But it doesn't help.
Thanks in advance,
Konstantin.