私の Ruby バージョン: ruby 1.8.7 (2011-02-18 パッチレベル 334) [i386-mingw32] 私の Rails バージョン: Rails 2.3.11
私が得ているエラーは次のとおりです。
No route matches "/hcfcdsensors/4513.0/show_graph_hcfcd" with {:method=>:post}
ここに私のモデルがあります
class Hcfcdsensor < ActiveRecord::Base
set_primary_key :device_id
has_one :hcfcdsensorvalue
has_many :hcfcdraindatas
end
class Hcfcdsensorvalue < ActiveRecord::Base
belongs_to :hcfcdsensor
end
class Hcfcdraindata < ActiveRecord::Base
set_table_name 'hcfcdraindata'
belongs_to :hcfcdsensor
end
私のルートは次のとおりです。
map.resources :hcfcdraindatas
map.resources :hcfcdsensors
map.show_graph_hcfcd 'hcfcdsensors/:device_id/show_graph_hcfcd', :controller => 'hcfcdsensors', :action => 'show_graph_hcfcd'
link_to_remote ステートメントは次のとおりです。
<%= link_to_remote "show" , :url => show_graph_hcfcd_url(@hcfcdsensors[0]) ,:update => "graphDiv" %>
「device_id」フィールドは double 型です。このルート システムは、プライマリ キーのオーバーライドを削除し、ルートの「:device_id」を「:id」に置き換えると正常に機能します。
どんな助けでも大歓迎です。
ありがとう、ショーナク