小编Mat*_*att的帖子

Rails 4可以找到没有孩子的父母

我找到了一个答案,其中有一些可用的having例子可以找到有n孩子的父母,但同样不能用于找到没有孩子的父母(大概是因为连接不包括他们).

scope :with_children, joins(:children).group("child_join_table.parent_id").having("count(child_join_table.parent_id) > 0")
Run Code Online (Sandbox Code Playgroud)

谁能指出我正确的方向?

ruby-on-rails rails-activerecord

34
推荐指数
2
解决办法
1万
查看次数

未初始化的常量OpenSSL(NameError)

我一直在使用OpenSSL开发一个解密数据文件的应用程序,但是当部署到我们的舞台服务器时这不起作用.是否需要一些配置步骤来包含我在服务器上遗漏的OpenSSL?我没有做任何特别的事情让它在本地工作(在Windows上开发).

导致错误的行是:

rescue_from OpenSSL::Cipher::CipherError, :with => :cipher_error
Run Code Online (Sandbox Code Playgroud)

在我的一个控制器中.

Ruby 1.8.7,Rails 3.0.4没有使用gems来添加OpenSSL支持,它只是在本地工作.

文件的实际解密工作正常(代码在模块中/lib),它只是控制器中的这一行失败.

openssl ruby-on-rails ruby-on-rails-3

12
推荐指数
1
解决办法
1万
查看次数

挽救模块内特定类型的所有错误

我有一个模块,我在其中执行项目的所有加密/解密任务.我想捕获OpenSSL::Cipher::CipherError此模块中发生的任何异常,以便我可以处理它们.

是否有可能做类似的事情

rescue_from OpenSSL::Cipher::CipherError, :with => :cipher_error
Run Code Online (Sandbox Code Playgroud)

在一个模块里面?

exception-handling ruby-on-rails rescue ruby-on-rails-3

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

控制台中的"Rails s"或"Rails c"失败:"看起来你的应用程序的./bin/rails是由Bundler生成的存根"

这是输出.到底是怎么回事?

使用Rails 3.x. 我已经尝试过"gem cleanup",然后"捆绑安装"无效.

有没有遇到过这个?

Looks like your app's ./bin/rails is a stub that was generated by Bundler.

In Rails 4, your app's bin/ directory contains executables that are versioned
like any other source code, rather than stubs that are generated on demand.

Here's how to upgrade:

  bundle config --delete bin    # Turn off Bundler's stub generator
  rake rails:update:bin         # Use the new Rails 4 executables
  git add bin                   # Add bin/ to source control

You may need to …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails ruby-on-rails-3

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

如何让xdmp:tidy()整理HTML5?

使用属于HTML5的新doctype和元素,您如何xdmp:tidy()识别HTML5中的那些?

如果我有一个包含以下内容的html页面:

<!DOCTYPE html>
<html>
    <header>blah</header>
    <section>blah</section>
Run Code Online (Sandbox Code Playgroud)

然后尝试类似的东西: xdmp:tidy(xdmp:document-get("home.html"))

我得到的错误如下:

<section> is not recognized! discarding unexpected <section>
<header> is not recognized! discarding unexpected <header>
Run Code Online (Sandbox Code Playgroud)

我可以发送一些选项xdmp:tidy()让它来处理它吗?

tidy marklogic

5
推荐指数
1
解决办法
1444
查看次数

执行Findbug规则时Sonar出错

在使用findbugs配置我的声纳项目后,我遇到了以下错误.请帮帮我.

BUILD FAILED
17-May-2013 11:18:15    /home/build/bamboo-home/xml-data/build-dir/EZIO-EMA-JOB1/build.xml:247: org.sonar.api.utils.SonarException: Can not execute Findbugs
17-May-2013 11:18:15            at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:120)
17-May-2013 11:18:15            at org.sonar.plugins.findbugs.FindbugsSensor.analyse(FindbugsSensor.java:58)
17-May-2013 11:18:15            at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64)
17-May-2013 11:18:15            at org.sonar.batch.phases.Phases.execute(Phases.java:93)
17-May-2013 11:18:15            at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:143)
17-May-2013 11:18:15            at org.sonar.batch.bootstrap.Module.start(Module.java:89)
17-May-2013 11:18:15            at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:110)
17-May-2013 11:18:15            at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:100)
17-May-2013 11:18:15            at org.sonar.batch.bootstrap.Module.start(Module.java:89)
17-May-2013 11:18:15            at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:96)
17-May-2013 11:18:15            at org.sonar.batch.bootstrap.Module.start(Module.java:89)
17-May-2013 11:18:15            at org.sonar.batch.Batch.execute(Batch.java:74)
17-May-2013 11:18:15            at org.sonar.ant.Launcher.execute(Launcher.java:70)
17-May-2013 11:18:15            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17-May-2013 11:18:15            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
17-May-2013 11:18:15            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
17-May-2013 11:18:15            at java.lang.reflect.Method.invoke(Method.java:597) …
Run Code Online (Sandbox Code Playgroud)

findbugs sonarqube

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

Rails:<%=和<%==之间的区别?

我正在寻找具有所有erb插值的遗留代码<%==...而且我之前从未使用过.

它是为了什么?它有什么不同<%=

ruby-on-rails erb

2
推荐指数
1
解决办法
139
查看次数