小编Dan*_*her的帖子

使用jQuery在图像上"绘制"简单线条并保存到Rails DB的最简单方法?

我想在图像上画线.基本上允许用户绘制他们喜欢的山路的路径.

1)有没有人知道一个很好的简单库来绘制基本线?

2)用户在图像上绘制一堆线后,将数据保存到数据库的最佳方法是什么?

jquery drawing ruby-on-rails lines

24
推荐指数
2
解决办法
4万
查看次数

茉莉花的流星速度没有回归期待的结果?

我正在尝试测试以下手动工作:

  1. 将用户列表返回为<div>s
  2. 单击按钮可将该计数减少<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或其​​他东西?也许有些异步方法可以回调?我不确定,但似乎是一个简单的错误.

javascript velocity jasmine meteor

18
推荐指数
1
解决办法
117
查看次数

APC显示100%碎片

APC显示100%碎片.这不好吗?

这是否意味着它根本没有帮助?我有哪些路径可以改善情况?

提前致谢.

php apc

16
推荐指数
2
解决办法
8902
查看次数

我如何在coffeescript中编写这个jQuery?

只是想学习和混淆如何做以下事情.谢谢!

$.each($(".nested-fields"), function(intIndex) {$(this).find(".set").html(intIndex+1);;} );
Run Code Online (Sandbox Code Playgroud)

再次感谢你.

javascript jquery coffeescript

9
推荐指数
1
解决办法
7352
查看次数

如何从belongs_to迁移到Mongoid中的embedded_in?

如果首先使用belongs_to和has_many关联构建模型,然后意识到他们需要转移到embedded_in和embeds_many关联,那么如何在不使数千条记录失效的情况下执行此操作?需要以某种方式迁移它们.

ruby-on-rails mongoid

9
推荐指数
1
解决办法
1843
查看次数

Named_scope中的rails唯一记录?

是否可以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可能会这样做,而我现在正在使用它.如果有人有任何评论,不管这是不是很好.

activerecord named-scope ruby-on-rails

8
推荐指数
1
解决办法
7017
查看次数

使用渲染模板app/app/views在heroku上进行奇怪的渲染

我有一个奇怪的问题.

本地一切都很好,当我在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?为什么它会有两个应用程序?我不确定是什么问题.这是一个非常基本的应用程序.我没有做任何花哨的事情.

ruby-on-rails heroku

8
推荐指数
1
解决办法
1511
查看次数

流星可怜的错误

我的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)

phantomjs meteor

7
推荐指数
1
解决办法
344
查看次数

为什么这是ERB的错误?

<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)

ruby erb

6
推荐指数
2
解决办法
6463
查看次数

如何使用Prerenderio与Meteor?

我想在模拟服务器上使用prerenderio和Meteor而不是phantomjs.

但是根据它们提供的示例,我不确定如何集成它.它们只提供一个节点表达中间件,它不能100%转换.

prerender meteor

6
推荐指数
1
解决办法
1796
查看次数