私はプログラミングとレールに不慣れなので、大きな見落としはご容赦ください。最近、railsアプリをherokuにデプロイし、すべての環境をdbのpostgresに切り替えました。HerokuはPostgresで問題なく動作しています-rakedb:drop db:migrate db:create db:seed allを実行して、データベースにrakeタスクを入力し、アプリの検索フォーム、フィルター、データクエリなどをテストしました。すべてうまくいきました。
しかし、ローカルサーバーを起動し、並べ替えのある2つのビューに移動した後、ブラウザーで「ActiveSupport :: SafeBufferとnilの比較に失敗しました」というエラーが表示されるようになりました。ブラウザーは、持っているビュー
<% @price_array.sort! {|x,y| x <=> y} %>
これは私がサーバーログに見るものです:
Rendered skis/index.html.erb within layouts/application (212.9ms)
Completed 500 Internal Server Error in 280ms
ActionView::Template::Error (comparison of ActiveSupport::SafeBuffer with nil failed):
51: <% ski.inventories.each do |inventory| %>
52: <% a.push(number_to_currency(inventory.price)) %>
53: <% end %>
54: <% @lowest_price = a.sort { |x,y| x <=> y} %>
55: from <%= @lowest_price.first %>
56: </br>
57: </li>
app/views/skis/index.html.erb:54:in `sort'
app/views/skis/index.html.erb:54:in `block in_app_views_skis_index_html_erb___2303745325449705978_70146899313600'
app/views/skis/index.html.erb:32:in `each'
app/views/skis/index.html.erb:32:in `_app_views_skis_index_html_erb___2303745325449705978_70146899313600'
app/controllers/skis_controller.rb:32:in `index'
これは、私が遭遇している問題に関連している可能性があります-postgresデータベースを削除できないようです。
これは私がpostgresのあるターミナルで見ているものです:
postgres=# \dbdrop postgres
List of tablespaces
Name | Owner | Location
------+-------+----------
(0 rows)
昨夜私がしたもう1つのことは、ここにある指示に従って.bash_profileを更新することでした(http://stackoverflow.com/questions/6770649/repairing-postgresql-after-upgrading-to-osx-10-7-lion)。これは私の.bash_profileが今どのように見えるかです:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
PATH=/usr/local/bin:$PATH
このエラーの原因となっている、欠落しているpostgresの構成はありますか?ヘルプやリソースをいただければ幸いです。ありがとう。