Where to configure Rails 3 cache_store?

I am trying to configure Rails 3 cache_store with something like this in /development.rb environments:

config.cache_store = :memory_store, {:size => 64.megabytes, :expires_in => 5.minutes}

But when I start the server, I get:

undefined method `megabytes' for 64:Fixnum (NoMethodError)

Something may not be loaded yet.

My question is: where is the place to configure them? Where should I place this code?

+5
source share
2 answers

Use ActionController::Base.cache_store =and put in the initialization file (create rb file in config / initializers)

+1
source

Or add this line

require 'active_support/core_ext/numeric/bytes'

before

config.cache_store = :memory_store, {:size => 64.megabytes, :expires_in => 5.minutes}
+15
source

All Articles