Created
June 28, 2012 12:55
-
-
Save tka/3011208 to your computer and use it in GitHub Desktop.
fire app fake data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- title: 測試活動 | |
date: "2012-01-05" | |
- title: uicafe | |
date: "2012-06-05" | |
- title: RGBA | |
date: "2012-07-05" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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