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