希望每个人都很好,做得好!我陷入一个奇怪的问题,我正在寻找你的输入.
我的问题是:
使用Capistrano在Production上部署我的应用程序后,当我进行solr重新索引时,它给出了以下错误:
$ bundle exec rake sunspot:reindex --trace
** Invoke sunspot:reindex (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sunspot:reindex
Skipping progress bar: for progress reporting, add gem 'progress_bar' to your Gemfile
rake aborted!
RSolr::Error::Http - 404 Not Found
Error: Not Found
Request Data: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><delete>query>type:OccupationData</query></delete>"
Backtrace: /data/APP_NAME/shared/bundled_gems/ruby/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:268:in `adapt_response'
/data/APP_NAME/shared/bundled_gems/ruby/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:175:in `execute'
/data/APP_NAME/shared/bundled_gems/ruby/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:161:in `send_and_receive'
(eval):2:in `post'
/data/APP_NAME/shared/bundled_gems/ruby/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:67:in `update'
/data/APP_NAME/shared/bundled_gems/ruby/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:131:in `delete_by_query'
/data/APP_NAME/shared/bundled_gems/ruby/1.9.1/gems/sunspot-1.3.3/lib/sunspot/indexer.rb:55:in `remove_all'
/data/APP_NAME/shared/bundled_gems/ruby/1.9.1/gems/sunspot-1.3.3/lib/sunspot/session.rb:181:in `block in remove_all'
/data/APP_NAME/shared/bundled_gems/ruby/1.9.1/gems/sunspot-1.3.3/lib/sunspot/session.rb:181:in `each'
/data/APP_NAME/shared/bundled_gems/ruby/1.9.1/gems/sunspot-1.3.3/lib/sunspot/session.rb:181:in `remove_all'
/data/APP_NAME/shared/bundled_gems/ruby/1.9.1/gems/sunspot-1.3.3/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'
/data/APP_NAME/shared/bundled_gems/ruby/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:268:in `adapt_response'
/data/APP_NAME/shared/bundled_gems/ruby/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:175:in `execute'
/data/APP_NAME/shared/bundled_gems/ruby/1.9.1/gems/rsolr-1.0.9/lib/rsolr/client.rb:161:in …Run Code Online (Sandbox Code Playgroud) 我有一个PG数据库表价格。结构如下:
id name total_sales created_at
1 A 0.0 2016-01-01
2 B 1.25 2016-01-01
3 C 8.17 2016-01-01
4 D 15.09 2016-01-01
5 E 0.0 2016-01-01
6 F NULL 2016-01-01
7 G 2.25 2016-01-01
8 H 19.34 2016-01-01
9 I 47.91 2016-01-01
10 J 0.0 2016-01-01
11 K NULL 2016-01-01
12 L 0.01 2016-01-01
13 M 5.11 2016-01-01
14 N 27.53 2016-01-01
15 O 3.53 2016-01-01
Run Code Online (Sandbox Code Playgroud)
我需要的很简单。我想订购这些记录:
按升序排列值 > 0.0 的项目首先出现,然后是 具有 0.0 的项目,然后是 NULLS LAST
简而言之,我需要按以下顺序进行操作:
1st: …Run Code Online (Sandbox Code Playgroud) 我正在使用Rails 4应用程序,最近遇到了一个奇怪的问题。我正在这里寻求您的帮助。好心提醒。
已创建一个小的要点代码片段,以了解未提交的未定义方法的问题?
只是总结一下一切:
# app/models
class User < ActiveRecord::Base
has_many :responses, dependent: :destroy
end
class Response < ActiveRecord::Base
has_one :report
has_many :points
belongs_to :user
end
class Report < ActiveRecord::Base
belongs_to :response
end
class Point < ActiveRecord::Base
belongs_to :response
end
# config/routes.rb
resources :users do
resources :responses do
resources :action_plans
end
end
# app/controllers/action_plans_controller.rb
class ActionPlansController < ApplicationController
before_filter :response
def new
@report = @response.build_report
5.times do
@response.points.build
end
end
private
def response
@response = current_user.responses.find(params[:id])
end …Run Code Online (Sandbox Code Playgroud)