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
-- 
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---