Rails随机数0到3之间始终为0或1

时间:2016-10-05 00:49:29

标签: ruby-on-rails-3

我使用随机数来尝试调用随机部分。我有export class AppComponent { constructor(jsonp:Jsonp) { var url = 'https://accounts.google.com/logout&c=JSONP_CALLBACK'; jsonp.request(url, { method: 'Get' }) .subscribe((res) => { (...) }); } }

@angular/http

但我也尝试了erb,同样的事情发生了:无论我点击按钮多少次,它都会显示<% @random_partial = 'man_tests/test' + [*0..3].sample %> <%= render partial: @random_partial %> rand(0..3).round.to_s。我已经做了足够的尝试,如果偶然的话,我只会得到这两个,这在统计上是疯狂的。我甚至尝试从_test0.html.erb_test1.html.erb切换内容以查看它是否以某种方式导致问题,我仍然只得到名为0和1的内容。

任何人都可以帮我找出造成这个问题的原因吗?

1 个答案:

答案 0 :(得分:0)

检查this fiddle out

fetchTweets()

另外,请确保您的服务器没有为某些缓存页面提供服务。

相关问题