root/lib/fixes.rb @ fc30c2a2
b689e231 | Marc Dequènes (Duck) | # needed for gettext
|
|
# see http://zargony.com/2008/02/12/edge-rails-and-gettext-undefined-method-file_exists-nomethoderror
|
|||
module ActionView
|
|||
class Base
|
|||
delegate :file_exists?, :to => :finder unless respond_to?(:file_exists?)
|
|||
end
|
|||
end
|
|||
# fix collection_select ignoring :selected option
|
|||
# needs to bug, see http://dev.rubyonrails.org/ticket/1125
|
|||
module ActionView::Helpers
|
|||
class InstanceTag
|
|||
def to_collection_select_tag(collection, value_method, text_method, options, html_options)
|
|||
html_options = html_options.stringify_keys
|
|||
add_default_name_and_id(html_options)
|
|||
value = value(object)
|
|||
selected_value = options.has_key?(:selected) ? options[:selected] : value
|
|||
content_tag(
|
|||
"select", add_options(options_from_collection_for_select(collection, value_method, text_method, selected_value), options, selected_value), html_options
|
|||
)
|
|||
end
|
|||
end
|
|||
end
|