Ruby 初心者スレッド ..
710:デフォルトの名無しさん
09/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'
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5392日前に更新/246 KB
担当:undef