小编Rub*_*tic的帖子

docker run - > name已被容器使用

使用以下命令运行docker注册表始终会引发错误:

dev:tmp me$ docker run \
     -d --name registry-v1 \
     -e SETTINGS_FLAVOR=local \
     -e STORAGE_PATH=/registry \
     -e SEARCH_BACKEND=sqlalchemy \
     -e LOGLEVEL=DEBUG \
     -p 5000:5000 \
     registry:0.9.1
Error response from daemon: Conflict. The name "registry-v1" is already in use by container f9e5798a82e0. You have to delete (or rename) that container to be able to reuse that name.
Run Code Online (Sandbox Code Playgroud)

如何防止此错误?

docker

321
推荐指数
15
解决办法
24万
查看次数

Rails 4:在子路径中组织rails模型而不使用命名空间模型?

有没有可能有这样的东西?

app/models/
app/models/users/user.rb
app/models/users/education.rb
Run Code Online (Sandbox Code Playgroud)

目标是更好地组织/ app/models文件夹,但不必命名模型.

Rails 3的一个悬而未决的问题是: Rails 3.2.9和子文件夹中的模型.

使用命名空间指定table_name似乎可行(请参阅Rails 4模型子文件夹),但我想在没有命名空间的情况下执行此操作.

namespaces ruby-on-rails models subdirectory ruby-on-rails-4

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

rails 4:404,500的自定义错误页面以及来自哪里的默认500错误消息?

目前正在制作中获取此文字:

500 Internal Server Error
If you are the administrator of this website, then please read this web application's     
log file and/or the web server's log file to find out what went wrong.
Run Code Online (Sandbox Code Playgroud)

该页面中没有任何HTML.

这段代码在哪里?我没有公开/ 500.html或这方面的任何事情.

在我的路线中,我有:

  get "/404", :to => "errors#error_404"
  get "/422", :to => "errors#error_404"
  get "/500", :to => "errors#error_500"
  get "/505", :to => "errors#error_505"
Run Code Online (Sandbox Code Playgroud)

ErrorsController:

class ErrorsController < ApplicationController

  def sub_layout
    "left"
  end

  def error_404
    render :status => 404, :formats => [:html], :layout => "white", …
Run Code Online (Sandbox Code Playgroud)

error-handling ruby-on-rails-4

54
推荐指数
3
解决办法
6万
查看次数

简单的rails rake任务拒绝运行时出现错误"不知道如何构建任务",为什么?

我有这个简单的rake任务拒绝运行.我只是不明白为什么它看起来正确.谁可以指出我可能非常简单的错误?谢谢!

/lib/tasks/reindex.rb:

namespace :db do

  desc "Tire reindex profiles"

  task :reindex => :environment do
    system "cd #{Rails.root} && rake environment tire:import CLASS='Profile' FORCE=true"
  end

end
Run Code Online (Sandbox Code Playgroud)

错误:

rake db:reindex
rake aborted!
Don't know how to build task 'db:reindex'
Run Code Online (Sandbox Code Playgroud)

rake ruby-on-rails rake-task

44
推荐指数
3
解决办法
4万
查看次数

ActiveRecord:如果存在,则更新记录吗?

尝试在Active Record中实现创建(如果不存在)其他更新记录.

目前使用:

@student = Student.where(:user_id => current_user.id).first

if @student
    Student.destroy_all(:user_id => current_user.id)
end

Student = Student.new(:user_id => current_user.id, :department => 1
)
Student.save!
Run Code Online (Sandbox Code Playgroud)

如果记录存在或者创建记录,更新记录的正确方法是什么?

activerecord ruby-on-rails-3

32
推荐指数
5
解决办法
4万
查看次数

ruby on rails 3.1将.swf移动到资产管道?

是否可以将SWF文件移动到资产管道,如果可能,如何才能完成?

flash ruby-on-rails-3.1 asset-pipeline

23
推荐指数
1
解决办法
5758
查看次数

一个干净的小宝石,为现有应用添加一个简单的博客?

我需要一个博客在我现有的应用程序内,但它不一定是花哨的,一些类别和一种方式将纺织品目录转换为博客帖子,包括日期将适合,已经搜索过但没有任何幻想出现.

关于将博客添加到现有rails应用程序的好宝石的任何建议?

gem blogs ruby-on-rails

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

rails 4:将routes.rb拆分为多个较小的文件

我想在rails 4应用程序中拆分我的路由.对于rails 3,问题已被回答了几次,例如:

在rails 4中执行此操作的正确方法是什么?如何控制路由加载的顺序?

建议从rails 3问题:

application.rb中

    config.paths['config/routes'] = Dir["config/routes/*.rb"]
Run Code Online (Sandbox Code Playgroud)

失败:

/Users/jordan/.rvm/gems/ruby-2.0.0-head@books/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:10:in,scue in execute_if_updated':Rails :: Application :: RoutesReloader #cute_if_updated委托给updater.execute_if_updated,但updater为nil:

@route_sets = [#]>(RuntimeError)

split routes ruby-on-rails-4

17
推荐指数
3
解决办法
6259
查看次数

rails 4 image_tag没有链接到我的消化图像资源

在rails 4中,我的image_tag("assets/logo.png")没有链接到带有摘要的文件,资产也被预编译了它们在public/assets/*中的图像.

我的production.rb:

Books::Application.configure do

  # Settings specified here will take precedence over those in config/application.rb.

  # Code is not reloaded between requests.
  config.cache_classes = true

  # Eager load code on boot. This eager loads most of Rails and
  # your application in memory, allowing both thread web servers
  # and those relying on copy on write to perform better.
  # Rake tasks automatically ignore this option for performance.
  config.eager_load = true

  # Full error reports are disabled and caching …
Run Code Online (Sandbox Code Playgroud)

assets digest precompiled asset-pipeline ruby-on-rails-4

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

在jquery mobile中使用谷歌地图的清晰方向示例?

尝试获得一个有效的jquery移动地图方向页面.列出了这个例子:

http://jquery-ui-map.googlecode.com/svn/trunk/demos/jquery-google-maps-mobile.html#directions_map
Run Code Online (Sandbox Code Playgroud)

但是示例代码很乱并且无法使其工作:(.宜家使用它.

http://m.ikea.com/nl/nl/stores/415/map/
Run Code Online (Sandbox Code Playgroud)

但他们也非常定制js所以很难看到会发生什么.

有没有人知道一个很容易理解的干净的例子或实现?

jquery google-maps google-maps-api-3 jquery-mobile

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