我想在图像上画线.基本上允许用户绘制他们喜欢的山路的路径.
1)有没有人知道一个很好的简单库来绘制基本线?
2)用户在图像上绘制一堆线后,将数据保存到数据库的最佳方法是什么?
我正在尝试测试以下手动工作:
<div>s<div>一个.这似乎不起作用:
it("should show one less person if you tap you liked them", function() {
var personLength = $('.person').length;
console.log(personLength); #> 7
$("[data-action=like]").first().click();
console.log($('.person').length); #> 7
console.log(Likes.find().fetch()); #> 1
expect($('.person').length).toEqual(person-1); #> Fail (expected 7 to equal 6)
});
Run Code Online (Sandbox Code Playgroud)
我很困惑为什么会这样做.手动测试时,我明显得到了预期的结果.
我想我错过了某种方法来重置该测试以再次查看DOM或其他东西?也许有些异步方法可以回调?我不确定,但似乎是一个简单的错误.
只是想学习和混淆如何做以下事情.谢谢!
$.each($(".nested-fields"), function(intIndex) {$(this).find(".set").html(intIndex+1);;} );
Run Code Online (Sandbox Code Playgroud)
再次感谢你.
如果首先使用belongs_to和has_many关联构建模型,然后意识到他们需要转移到embedded_in和embeds_many关联,那么如何在不使数千条记录失效的情况下执行此操作?需要以某种方式迁移它们.
是否可以named_scope为某列提供唯一的返回记录?
例如
named_scope :unique_styles, :order =>"title desc", :limit => 3
Run Code Online (Sandbox Code Playgroud)
这会给我三种风格,但如果我想确定标题不同怎么办?在这种情况下,可能有三个具有相同样式的记录,我希望这个named_scope只给出标题的唯一值.
所以["style 1", "style 1", "style 1"]不可能,它会强迫自己给予["style 1", "some style 2", "maybe another 3"]
group可能会这样做,而我现在正在使用它.如果有人有任何评论,不管这是不是很好.我有一个奇怪的问题.
本地一切都很好,当我在Heroku上启动时,我收到此错误:
2011-12-31T06:26:23+00:00 app[web.1]: ActionView::MissingTemplate (Missing template pages/index, application/index with {:handlers=>[:erb, :builder], :formats=>[:html], :locale=>[:en, :en]}. Searched in:
2011-12-31T06:26:23+00:00 app[web.1]: * "/app/app/views"
2011-12-31T06:26:23+00:00 app[web.1]: ):
Run Code Online (Sandbox Code Playgroud)
为什么会爆炸/app/app/views?为什么它会有两个应用程序?我不确定是什么问题.这是一个非常基本的应用程序.我没有做任何花哨的事情.
我的phantomjs/spiderable包仍然无法生产.
spiderable: phantomjs failed: Error: Command failed:
at ChildProcess.exithandler (child_process.js:648:15)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
spiderable: phantomjs failed: Error: Command failed:
at ChildProcess.exithandler (child_process.js:648:15)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
spiderable: phantomjs failed: Error: Command failed:
at ChildProcess.exithandler (child_process.js:648:15)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
spiderable: phantomjs failed: Error: Command failed:
at ChildProcess.exithandler (child_process.js:648:15)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
spiderable: phantomjs failed: Error: Command failed:
at …Run Code Online (Sandbox Code Playgroud) <div class='row'>
<%= form.field_container :name do %>
<%= form.label :name, raw('Name' + content_tag(:span, ' *', :class => 'required')) %>
<%= form.text_field :name, :class => 'fullwidth' %>
<%= form.error_message_on :name %>
<% end %>
</div>
Run Code Online (Sandbox Code Playgroud)
为什么会产生以下错误?
$ erb -x -T - test.erb | ruby -c
-:3: syntax error, unexpected ')'
...form.field_container :name do ).to_s); _erbout.concat "\n"
... ^
-:9: syntax error, unexpected $end, expecting ')'
Run Code Online (Sandbox Code Playgroud) 我想在模拟服务器上使用prerenderio和Meteor而不是phantomjs.
但是根据它们提供的示例,我不确定如何集成它.它们只提供一个节点表达中间件,它不能100%转换.
meteor ×3
javascript ×2
jquery ×2
activerecord ×1
apc ×1
coffeescript ×1
drawing ×1
erb ×1
heroku ×1
jasmine ×1
lines ×1
mongoid ×1
named-scope ×1
phantomjs ×1
php ×1
prerender ×1
ruby ×1
velocity ×1