Module: RedisSnippets::Util

Included in:
SnippetsController, SnippetsHelper, SnippetFinderService, SnippetPresenter
Defined in:
lib/redis_snippets/util.rb

Instance Method Summary collapse

Instance Method Details

#snippet_key(key) ⇒ Object

If multi_site is true the symbol returned will have the key returned with a prefix. This prefix is defined in your application using the redis_snippet_site_key method. redis_snippet_site_key should simply return a unique string per site. For instance it could be the domain of the site.



7
8
9
10
11
# File 'lib/redis_snippets/util.rb', line 7

def snippet_key(key)
  s = RedisSnippets::Engine.config.redis_snippets[:multi_site] ? redis_snippet_site_key + ':' : ''
  s << key.to_s
  s.to_sym
end