2

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?

Pedro Montoto García
  • 1,672
  • 2
  • 18
  • 38

1 Answers1

3

You can use class variables.

class Connection
  def initialize
    @@connection ||= # Start connectio
  end
end
Dan Grahn
  • 9,044
  • 4
  • 37
  • 74