Use Hash#fetch instead
This commit is contained in:
parent
f98b2d5332
commit
c7bdbb3f76
|
@ -145,7 +145,7 @@ module SimpleForm
|
|||
end
|
||||
|
||||
def render_collection(attribute, collection, value_method, text_method, options={}, html_options={}) #:nodoc:
|
||||
item_wrapper_tag = options.key?(:item_wrapper_tag) ? options[:item_wrapper_tag] : SimpleForm.item_wrapper_tag
|
||||
item_wrapper_tag = options.fetch(:item_wrapper_tag, SimpleForm.item_wrapper_tag)
|
||||
|
||||
rendered_collection = collection.map do |item|
|
||||
value = value_for_collection(item, value_method)
|
||||
|
@ -164,8 +164,8 @@ module SimpleForm
|
|||
value.respond_to?(:call) ? value.call(item) : item.send(value)
|
||||
end
|
||||
|
||||
def wrap_rendered_collection(collection, options)
|
||||
wrapper_tag = options.key?(:collection_wrapper_tag) ? options[:collection_wrapper_tag] : SimpleForm.collection_wrapper_tag
|
||||
def wrap_rendered_collection(collection, options) #:nodoc:
|
||||
wrapper_tag = options.fetch(:collection_wrapper_tag, SimpleForm.collection_wrapper_tag)
|
||||
|
||||
if wrapper_tag
|
||||
wrapper_class = [SimpleForm.collection_wrapper_class, options[:collection_wrapper_class]].compact.presence
|
||||
|
|
Loading…
Reference in New Issue