Eval (string)? #39

Closed
rutgerg opened this Issue Oct 18, 2012 · 2 comments

Projects

None yet

2 participants

@rutgerg

Thanks for this gem. Question: I"m using settingslogic for setting expires_in setting in memcache eg

Rails.cache.fetch("Time_now", :expires_in => Settings.expires_in) {Time.now}

if I set the expires_in in the application.yml it will be a string eg 2.minutes which will not be understood by Memcached. The way I currently make this work is do

Rails.cache.fetch("Time_now", :expires_in => eval(Settings.expires_in)) {Time.now}

Is this the way to go or does anybody have a better solution?

@goosetav

settingslogic runs the file through erb before processing it, just set your value like this:

defaults:
  expires_in: <%= 2.minutes %>
@rutgerg

Txs

@rutgerg rutgerg closed this Nov 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment