Skip to content

Instantly share code, notes, and snippets.

@maylogger
Forked from tka/fake_data.yml
Created June 28, 2012 12:57
Show Gist options
  • Save maylogger/3011216 to your computer and use it in GitHub Desktop.
Save maylogger/3011216 to your computer and use it in GitHub Desktop.
fire app fake data
- title: 測試活動
date: "2012-01-05"
- title: uicafe
date: "2012-06-05"
- title: RGBA
date: "2012-07-05"
module ViewHelpers
def fake_event(attr)
@fake_events||=YAML.load_file(File.join(File.dirname(__FILE__), 'fake_data.yml'))
data = @fake_events[rand(@fake_events.size)][attr.to_s]
if RUBY_VERSION > '1.9'
return data.force_encoding('utf-8')
else
return data
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment