Ruby 2.0已经发布,请参阅:
http://www.ruby-lang.org/en/news/2013/02/24/ruby-2-0-0-p0-is-released/
在将系统升级到Ruby 2.0后,我预计会对我的Rails App/Installation进行哪些更改?
根据我的研究:
我需要检测此功能何时不可用.不可能?
附加说明
我正在尝试检测是否可以通过target = _blank打开一个新窗口.例如,UIWebView [应用内浏览器]可以阻止target = _blank按预期工作[它只是在同一个窗口而不是新窗口中打开].我需要一个解决方案来指示由于浏览器限制而无法打开新窗口,例如在UIWebView案例中.不幸的是,弹出窗口阻止程序阻止检查这样的功能,因为它们永远不允许打开新窗口而无需绕过用户输入(即点击).
我创建了一个minitest.rake,根据ryan bates railcast(http://railscasts.com/episodes/327-minitest-with-rails).
当我在终端中运行rake时,测试运行,然后在重置命令行之前再次运行.
require "rake/testtask"
Rake::TestTask.new(:test => "db:test:prepare") do |t|
t.libs << "test"
t.pattern = "test/**/*_test.rb"
end
task default: :test
Run Code Online (Sandbox Code Playgroud) 首先,我有一个工作轨道'show'页面,显示项目名称和属于项目的条目.当使用angular $ scope显示项目名称并使用ERB中的块使用条目时,我的测试通过了.当我用角度指令'ng-repeat'替换条目ERB代码时,只有我的条目测试场景开始失败.有趣的是,该应用程序仍然在浏览器中工作.请记住,我视图中的另一个$ scope变量仍然使用几乎相同的测试.
使用show.html.erb(在ERB中查看的条目):
<div ng-controller="ProjectCtrl">
<h1>This is {{ project.details.name }}</h1>
<h2>Entries</h2>
<% @entries.each do |e| %>
<ul>
<li>
<%= e.title %>
</li>
<li>
<%= e.summary %>
</li>
</ul>
<% end %>
</div>
Run Code Online (Sandbox Code Playgroud)
打破show.html.erb(以Angular方式查看的条目):
<div ng-controller="ProjectCtrl">
<h1>This is {{ project.details.name }}</h1>
<h2>Entries</h2>
<ul ng-repeat=" e in project.entries ">
<li>
{{ e.title }}
</li>
<li>
{{ e.summary }}
</li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
Angular Controller,数据已被返回的JSON替换.
@ProjectCtrl = ["$scope", "$http", ($scope, $http) ->
$http.get().success (data) ->
$scope.project = {"details":{"name":"Project1","author":"brian"},"updated_at":"2013-04-13T16:48:46.406Z","entries":[{"title":"Test Title","summary":"Summary Test"},{"title":"The …Run Code Online (Sandbox Code Playgroud) 当我升级时,ng-repeat需要非常长的时间来加载并尝试显示更多内容框而没有$ resource提供的内容.
我已将问题缩小到1.1.0和1.1.1之间的更新.我查看了更改日志,但没有任何东西突然出现在我身上,但它必须在那里.
Changelog => https://github.com/angular/angular.js/blob/master/CHANGELOG.md#111-pathological-kerning-2012-11-26
此应用程序的存储库=> https://github.com/brianpetro/resume
目前我的角度看起来像:
app = angular.module("Resume", ["ngResource"])
app.factory "Entry", ["$resource", ($resource) ->
$resource("/entries")
]
@EntryCtrl = ["$scope", "Entry", ($scope, Entry) ->
$scope.entries = Entry.query()
]
Run Code Online (Sandbox Code Playgroud)
使用ng-repeat在多个视图上发生这种情况:
<html ng-app="Resume">
<div ng-controller="EntryCtrl">
<ul>
<li ng-repeat="entry in entries">
{{entry.title}}
</li>
</ul>
</div>
</html>
Run Code Online (Sandbox Code Playgroud)
这是AngularJS版本1.1.0:
这是AngularJS版本1.1.1:
