小编fat*_*rog的帖子

PostgreSQL无间隙序列

我正在从MySql迁移到Postgres,我注意到当您从MySql中删除行时,这些行的唯一ID会在您创建新行时重复使用.使用Postgres,如果您创建行并删除它们,则不会再次使用唯一ID.

在Postgres有这种行为的原因吗?在这种情况下,我可以使它更像MySql吗?

postgresql ruby-on-rails sequence

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

Capistrano和Bundler问题 - 捆绑:未找到

尝试使用捆绑/安装选项部署我的应用程序时,我不断收到以下错误:

    failed: "sh -c 'cd /home/deploy/swamp/releases/20110903003336 
    && bundle install --gemfile /home/deploy/swamp/releases/20110903003336/Gemfile 
    --path /home/deploy/swamp/shared/bundle --deployment --quiet 
    --without development test'" on 12.345.678.98
Run Code Online (Sandbox Code Playgroud)

**更新 - 看起来我错过了一个错误:

[err :: 12.345.678.98] sh: bundle: not found
Run Code Online (Sandbox Code Playgroud)

我在deploy.rb中试过这个:

require "bundler/capistrano"
Run Code Online (Sandbox Code Playgroud)

我试过这个:

namespace :bundler do
  task :create_symlink, :roles => :app do
    shared_dir = File.join(shared_path, 'bundle')
    release_dir = File.join(current_release, '.bundle')
    run("mkdir -p #{shared_dir} && ln -s #{shared_dir} #{release_dir}")
  end
  task :bundle_new_release, :roles => :app do
    bundler.create_symlink
    run "cd #{release_path} && bundle install --without test"
  end
end
after 'deploy:update_code', 'bundler:bundle_new_release' …
Run Code Online (Sandbox Code Playgroud)

capistrano ruby-on-rails bundler

8
推荐指数
3
解决办法
9513
查看次数

Capistrano编译资产错误 - 资产:预编译:非文化?

我的应用程序似乎正在正确部署,但我收到此错误:

      * executing "cd /home/deploy/tomahawk/releases/20120208222225 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
    servers: ["ip_address"]
    [ip_address] executing command
*** [err :: ip_address] /opt/ruby/bin/ruby /opt/ruby/bin/rake assets:precompile:nondigest RAILS_ENV=production RAILS_GROUPS=assets
Run Code Online (Sandbox Code Playgroud)

我在这里尝试过尝试编译资产的解决方案:http://lassebunk.dk/2011/09/03/getting-your-assets-to-work-when-upgrading-to-rails-3-1/

在这里:http://railsmonkey.net/2011/08/deploying-rails-3-1-applications-with-capistrano/

在这里:http://dev.af83.com/2011/09/30/capistrano-rails-3-1-assets-can-be-tricky.html

这是我的deploy.rb:

require "bundler/capistrano"
load 'deploy/assets'

set :default_environment, {
 'PATH' => "/opt/ruby/bin/:$PATH"
}

set :application, "tomahawk"
set :repository,  "repo_goes_here"
set :deploy_to, "/home/deploy/#{application}"
set :rails_env, 'production'
set :branch, "master"

set :scm, :git
set :user, "deploy"
set :runner, "deploy"
set :use_sudo, true

role :web, "my_ip" …
Run Code Online (Sandbox Code Playgroud)

deployment capistrano ruby-on-rails-3.1

8
推荐指数
2
解决办法
8298
查看次数

Rails&Capistrano 3 - 尝试用户生产数据库的登台服务器

我使用NGINX和Passenger为我的登台环境设置了一台服务器.我还设置了一个staging.rb文件,该文件与环境下的production.rb文件重复.在我的database.yml文件中,我已经进入了一个临时配置:

  staging:
  adapter: mysql2
  database: myapp_staging
  username: root
  password: xxxxxxxxxxxxx
  port: 3306
  pool: 15
  timeout: 5000
Run Code Online (Sandbox Code Playgroud)

环境/ staging.rb:

role :app, %w{deploy@111.111.111.111}
role :web, %w{deploy@111.111.111.111}
role :db,  %w{deploy@111.111.111.111}


# Extended Server Syntax
# ======================
# This can be used to drop a more detailed server definition into the
# server list. The second argument is a, or duck-types, Hash and is
# used to set extended properties on the server.

server '111.111.111.111', user: 'deploy', roles: %w{web app db}, port: 0001
Run Code Online (Sandbox Code Playgroud)

我部署, …

capistrano ruby-on-rails staging

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

无法删除RVM中的bundler

我在RVM中安装了1.9.2 Ruby.当我做一个宝石列表时,我得到了这个:

bundler (1.1.3)
Run Code Online (Sandbox Code Playgroud)

当我尝试删除它时,我得到:

gem uninstall bundler
INFO:  gem "bundler" is not installed
Run Code Online (Sandbox Code Playgroud)

当我尝试为我的应用程序运行bundle install时,我得到:

 Bundler could not find compatible versions for gem "bundler":
  In Gemfile:
    rails (= 3.0.1) ruby depends on
      bundler (~> 1.0.0) ruby

  Current Bundler version:
    bundler (1.1.3)

This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
Run Code Online (Sandbox Code Playgroud)

我试过卸载1.9.2,但没有帮助.

bundler ruby-on-rails-3 ruby-1.9.2

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

form_for转到错误的URL

我在订单查看页面上,我想更新该订单上的订单项:

我有我的路线:

  resources :order_line_details do
    member do 
      put  :update_barcode
    end
  end
Run Code Online (Sandbox Code Playgroud)

然后我的form_for:

<%= form_for update_barcode_order_line_detail_path(@order_line_detail) do |f| %>
<%= f.text_field :hds_barcode  %>
<%= f.submit 'Submit' %>
<% end %>
Run Code Online (Sandbox Code Playgroud)

当我提交时,它再次进入订单:

No route matches "/orders/20888"
Run Code Online (Sandbox Code Playgroud)

耙路线:(订单和订单详情)

orders GET      /orders(.:format)                                              {:action=>"index", :controller=>"orders"}
                                  orders POST     /orders(.:format)                                              {:action=>"create", :controller=>"orders"}
                               new_order GET      /orders/new(.:format)                                          {:action=>"new", :controller=>"orders"}
                              edit_order GET      /orders/:id/edit(.:format)                                     {:action=>"edit", :controller=>"orders"}
                                   order GET      /orders/:id(.:format)                                          {:action=>"show", :controller=>"orders"}
                                   order PUT      /orders/:id(.:format)                                          {:action=>"update", :controller=>"orders"}
                                   order DELETE   /orders/:id(.:format)                                          {:action=>"destroy", :controller=>"orders"}


   update_barcode_order_line_detail PUT      /order_line_details/:id/update_barcode(.:format)               {:action=>"update_barcode", :controller=>"order_line_details"}
                      order_line_details GET      /order_line_details(.:format)                                  {:action=>"index", :controller=>"order_line_details"} …
Run Code Online (Sandbox Code Playgroud)

forms routes ruby-on-rails

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