NoMethodError

Rails guru

Our rails web applicaion always show NoMethodError after runing some
time.

This NoMethodError throw from controller during the access to
ActiveRecord association method. But we define a belongs_to in the
active record

Error happends on serveral pages, serveral controller and serveral
active record

Version:
ruby 1.8.4. Rails 1.1.4
rails plugin into apache server (2.0.48) and fast_cgi module ( probably
2.4.2)

Thanks a lot

Jian Zhang wrote:

Rails guru

Our rails web applicaion always show NoMethodError after runing some
time.

This NoMethodError throw from controller during the access to
ActiveRecord association method. But we define a belongs_to in the
active record

Error happends on serveral pages, serveral controller and serveral
active record

Version:
ruby 1.8.4. Rails 1.1.4
rails plugin into apache server (2.0.48) and fast_cgi module ( probably
2.4.2)

Thanks a lot

More information

In a controller action, I switch to another db connection. The rest of
controller use the default active record db connection. After I switch
another db connection and then back, then NoMethodError happens. But I
keep a separate db connection in subclass. Is rails cache active record
action somewhere?. And I try to set config.cache_classes and
config.action_controller.perform_caching, still doesnt work.

Class AController < ApplicationController
def othermthods
do_B(args)
end

class B < ActiveRecord::Base # keep a separate db connection
end

def do_B(args)

B.establish_connection(
  :adapter  => "mysql",
  :host     => "xxxx",
  :username => "xxxx",
  :password => "xxxx",
  :database => "xxxx"
)

issues = B.connection.select_values("select ...");
B.connection.disconnect!

end
end