Is it possible to use two different databases for the same project in Ruby On Rails?
At the moment I use PostgreSQL with Heroku for my project and I would like to use Redis to store some of my models.
Thanks
First step, add redis-rb to your Gemfile:
gem 'redis', '2.1.1'
Then install the gem via Bundler:
bundle install
Lastly, create an initializer in config/initializers/redis.rb and add the following:
$redis = Redis.new(:host => 'localhost', :port => 6379)
Will that have any side effects to my existing database PostgreSQL database?
Or I ‘ll able to use $redis whenever I want to store something?
If you follow the steps you’ve written, you shouldn’t have any problems with ActiveRecord/Postgres
$rediswill work fine for you, as long as the connection works.