Sha256: 4844a4be62592cff612afb537f519faaf24eb3e033829fcc655a321dcd6d6315
Contents?: true
Size: 956 Bytes
Versions: 5
Compression:
Stored size: 956 Bytes
Contents
# Redis Snippets ## Background Easily store snippets of content in Redis. ## How It's a Rails 3 engine so add redis-snippets to your Gemfile and put this in an initializer: ``` ruby App::Application.config.redis_snippets = { :connection => ::Redis::Namespace.new("my_namespace", :redis => ::Redis.new), :keys => [:key1, :key2] } ``` You should then be able to access /admin/snippets/. In your views use helper snippet(). ``` ruby <%= snippet(:key1) %> ``` ## Multi Site If you're using one app to serve multiple sites a little more configuration is necessary. ``` ruby App::Application.config.redis_snippets = { :connection => ::Redis::Namespace.new("my_namespace", :redis => ::Redis.new), :multi_site => true, :keys => [:key1, :key2] } ``` And add this method to your ApplicationController: ``` ruby helper_method :redis_snippet_site_key def redis_snippet_site_key request.host end ``` ## Requirements * redis * redis-namespace
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
redis_snippets-0.0.9 | README.md |
redis_snippets-0.0.8 | README.md |
redis_snippets-0.0.7 | README.md |
redis_snippets-0.0.6 | README.md |
redis_snippets-0.0.5 | README.md |