Skip to content

Instantly share code, notes, and snippets.

View pedroaugusto's full-sized avatar

Pedro Benevides pedroaugusto

View GitHub Profile
@swoker
swoker / i18n_redis
Last active November 5, 2020 06:42
Set Redis as I18n Cache in Rails
### Gemfile
gem 'redis', '~> 3.0.2'
gem 'redis-rails', '~> 3.2.3'
### as initializer or in application.rb
$redis = Redis.new(:host => 'localhost', :port => 6379)
# delete all i18n keys before so they will be reloaded
$redis.keys.find_all{|k| k.start_with? "i18n"}.each {|k| $redis.del k}
FactoryGirl.define do
factory :photo do
image { Rack::Test::UploadedFile.new('spec/factories/test.png', 'image/png') }
description 'test description'
end
end