- 710 名前:デフォルトの名無しさん mailto:sage [2009/01/23(金) 10:24:50 ]
- Rails1.2.6を使って作成しているのですが、selectを動的に変化させようとすると ActionView::TemplateError (undefined method `number_select' for #<HashWithIndifferentAccess:0xb722adf0>
というのが出てしまいます。回避策があればご教授ください。 <やっていること> index.rhtmlの中を次のようにしています。 <div id="all"> <table> <tr><td id="first"><%= render :partial => 'first_info' %></td id="first"></tr> <tr><td id="second"><%= render :partial => 'second_info' %></td id="second"></tr> <tr><td id="third"><%= render :partial => 'third_info' %></td id="third"></tr> </table> </div id="all"> _first_info.rhtmlには次のような selectがあります。 <%= select(:first_info, :number_select, @numbers, {:selected => @select_value}, {:onchange => remote_function(:submit => :first_info, :url => { :action => :change_select }}) %> @numbersはコントローラー側で @numbers = ActiveSupport::OrderedHash.new してデータベースから値を格納しています。 _second_info.rhtml のテキストボックスに値を入力し、ボタンを押したら、その値をDBに登録し、_first_info.rhtmlの selectのリストに入力値を追加しようと以下のように処理しています。 1.コントローラーの_second_info.rhtmlから次の関数が呼ばれる def second データベースへ登録 @numbers = ActiveSupport::OrderedHash.new @numbers へデータベースの値を格納 @select_value = 1 end 2. second.rjsは _first_info.rhtmlを更新するため、次のようになっている page[:first_info].replace_html :partial => 'first_info'
|

|