I have smth like this: f.collection_select with options
I need to modify the standard behaviour of that collection_select (I need to add some option there)
Where should I do that?
I don't think this code is working, but you'll understand the idea
def collection_select(method, collection, value_method, text_method, options = {}, html_options = {})
if options[:create_div]
return '<div>' + @template.collection_select(@object_name, method, collection, value_method, text_method, objectify_options(options), @default_options.merge(html_options)) + '</开发者_StackOverflowdiv>'
end
@template.collection_select(@object_name, method, collection, value_method, text_method, objectify_options(options), @default_options.merge(html_options))
end
You should wrap it as a helper. You can use app/helpers/application_helper.rb
精彩评论