小编iHi*_*HiD的帖子

由于readline错误,无法执行"rails console"

rails console由于此错误,我无法执行:

localhost:TwitterForZombies wiz$ rails c
/Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/irb/completion.rb:9:in `require': dlopen(/Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin12.2.1/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.2.dylib (LoadError)
  Referenced from: /Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin12.2.1/readline.bundle
  Reason: image not found - /Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin12.2.1/readline.bundle
    from /Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
    from /Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands/console.rb:3:in `require'
    from /Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands/console.rb:3:in `<top (required)>'
    from /Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:38:in `require'
    from /Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:38:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
Run Code Online (Sandbox Code Playgroud)

我通过自制软件安装了readline.我想继续使用rbenv而不是rvm.

感谢您阅读我的问题.

ruby homebrew ruby-on-rails ruby-on-rails-3 rbenv

86
推荐指数
7
解决办法
2万
查看次数

你如何生成密码?

你如何生成密码?

  • 随机字符?
  • 密码短语?
  • 高Ascii?

像这样的东西?

cat /dev/urandom | strings
Run Code Online (Sandbox Code Playgroud)

random passwords ascii passphrase character

32
推荐指数
7
解决办法
2万
查看次数

如何在更新注册商记录之前测试新的名称服务器?

我在新的DNS提供商处配置了一组DNS记录.配置很复杂,有负载均衡,SSL等,有些东西可能出错.

我想在注册器更改命名空间记录之前测试此配置.

  • 有没有办法在本地为我的机器提供域名的新名称服务器?
  • 有没有什么工具可以帮助解决这个问题?

请注意:我不想只更新A记录(例如/etc/hosts) - 我想专门检查名称服务器是否返回A和CNAME记录.

dns nameservers amazon-route53

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

由于SSL证书问题,无法通过浏览器或控制台访问Github

突然间,我在尝试克隆回购时遇到了以下错误.

git clone https://github.com/repo/xxx.git
Cloning into 'hits'...
fatal: unable to access 'https://github.com/repo/xx.git/': SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Run Code Online (Sandbox Code Playgroud)

我在访问Chrome浏览器时遇到SSL错误 在此输入图像描述

这是获得Cert详细信息时获得的信息

在此输入图像描述

我使用的是10.6 OSX Leopard

git macos ssl

11
推荐指数
1
解决办法
4130
查看次数

在帮助器中呈现content_for块

我试图通过帮助器呈现content_for块的结果.

我有一个模板(HAML)和布局如下:

# app/views/books/show.html.haml
-content_for(:page_header) do
     %h1= @book.title

# app/views/application.html.haml
...
=yield(:page_header) 
...
Run Code Online (Sandbox Code Playgroud)

这非常好.

我想要做的是在帮助器中进行调用.所以我的目标是:

# app/views/books/show.html.haml
-content_for(:page_header) do
     %h1= @book.title

# app/views/application.html.haml
....
=page_header(block)
....

# app/helpers/application.rb
....
def page_header(&block)

    # Some view logic
    # ...

    =yield(:page_header)
end
....
Run Code Online (Sandbox Code Playgroud)

我可以通过调用帮助程序来实现部分结果:

# app/views/application.html.haml
=page_header { yield(:page_header) }

# app/helpers/application.rb
def page_header(&block)
  yield
end
Run Code Online (Sandbox Code Playgroud)

但这让我觉得难看.

有任何想法吗?提前致谢.

解答:再次使用content_for(:page_header)进行渲染.

templates ruby-on-rails helpers

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

在EmberJS获得父路线

我正在制作一个可重用的(有点多态)评论小部件.我想要一个按钮,让我回到父路线(例如,如果我在/ blog_posts/1 /评论,我想按钮将我带回/ blog_posts/1).

我目前正在使用transitionToRoute('blog_post'),但从长远来看这不会起作用,因为我希望这个代码一般可以运行任何模型(即它不会知道路由的名称,所以我不能称之为'blog_post') .我想我正在寻找像Rails url_for这样的东西,或者说router.get('parent_route')(或controller.get('parent_route'))的方式.

任何指针或想法?谢谢.

ember.js

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

如何在C#中使用消息框?

如何在没有脚本的情况下在C#中使用消息框?

c#

-1
推荐指数
1
解决办法
168
查看次数

如何在Android应用中搜索Google?

我需要创建一个搜索Google的Android应用.我用这个代码:

Intent browser=new Intent(Intent.ACTION_VIEW);
browser.setData(Uri.parse("http://google.com/#q=qwerty"));
startActivity(browser);
Run Code Online (Sandbox Code Playgroud)

但是,浏览器会加载Google主页,而我需要一个搜索"qwerty"结果的页面.

我该怎么做?

java android

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