Search code examples
ruby-on-railsrubydatabaseruby-on-rails-4

How does ruby on rails free database resources and close connections?


I have never worked with ruby on rails when I was thinking about error handling, I thought about freeing database resources and closing connections, I was investigating about this, but I didn't find a lot of information, then my questions are: How does ruby on rails free database resources and close connections? Do we have to do this task or ruby on rails does it for us? If we have to do this task, what's the correct process? If it's possible, share some links about this please.

Thanks for your help.


Solution

  • Rails has a DB connection pool. Its size can be configured in the config/database.yml. You do not have to clean up connections yourself.

    Read more about the ConnectionPool in the Rails docs