select
すべての選択ボックスがdisabled
デフォルトで属性を取得するように、 Rails のメソッドをカスタム フォーム ヘルパーでオーバーライドしようとしています。
class LabelFormBuilder < ActionView::Helpers::FormBuilder
def select(method, choices, options = {}, html_options = {})
html_options.reverse_merge! :disabled => true
super(method, choices, options = {}, html_options = {})
end
end
問題は、コードが機能せず、選択ボックスのレンダリング方法が何も変更されないことです。エラーも出ません。
これは、関数を呼び出すために使用するビュー コードです。
<%= f.select(:person_id, current_user.person_names, {:prompt => 'Please select...'}) %>
ここで何が欠けていますか?
助けてくれてありがとう...