문제

Is there a way to have objects on a Rails app that conserve their state between HTTP transactions?

For example, can I initialize a Net::LDAP connection somewhere and use it to retrieve data only restarting it on lost connection?

도움이 되었습니까?

해결책

You can use class variables.

class Connection
  def initialize
    @@connection ||= # Start connectio
  end
end
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top