Skip to content
This repository has been archived by the owner on Sep 2, 2019. It is now read-only.

example how to add namespace to redis #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rilian
Copy link

@rilian rilian commented Feb 12, 2014

spent couple of hours reading the gem, and decided to share the knowledge with public on this

@JonMidhir
Copy link
Contributor

👍

Thank you! Worked for me, and I've seen others use this approach. It should be added to the Readme as it's quite common IMO. Just needs a typo fix (extra comma, missing apostrophe):

adapter = DataMapper.setup(:default, { adapter: 'redis' })

adapter.resource_naming_convention = lambda do |value|
  ['application_name', 'stage', DataMapper::Inflector.pluralize(DataMapper::Inflector.underscore(value)).gsub('/', '_')].join(':')
end

@rilian
Copy link
Author

rilian commented Nov 27, 2014

hi @JonMidhir

actually i do not use this technique for a long time and have Redis instances running on different ports and when needed, hosts

in this case code is much clear and you should not worry about data overwrites and backup

@JonMidhir
Copy link
Contributor

That's cool, and probably ideal, but I think it would be quite a common requirement that the adapter support namespaces in some way

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants