mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Small #label method refactoring, thanks @rafaelfranca
This commit is contained in:
parent
889bb4b786
commit
806f4d8af0
1 changed files with 2 additions and 3 deletions
|
@ -34,7 +34,6 @@ module ActionView
|
||||||
|
|
||||||
if block_given?
|
if block_given?
|
||||||
content = @template_object.capture(&block)
|
content = @template_object.capture(&block)
|
||||||
label_tag(name_and_id["id"], content, options)
|
|
||||||
else
|
else
|
||||||
content = if @content.blank?
|
content = if @content.blank?
|
||||||
@object_name.gsub!(/\[(.*)_attributes\]\[\d\]/, '.\1')
|
@object_name.gsub!(/\[(.*)_attributes\]\[\d\]/, '.\1')
|
||||||
|
@ -56,6 +55,7 @@ module ActionView
|
||||||
end
|
end
|
||||||
|
|
||||||
content ||= @method_name.humanize
|
content ||= @method_name.humanize
|
||||||
|
end
|
||||||
|
|
||||||
label_tag(name_and_id["id"], content, options)
|
label_tag(name_and_id["id"], content, options)
|
||||||
end
|
end
|
||||||
|
@ -63,4 +63,3 @@ module ActionView
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
Loading…
Reference in a new issue