Skip to content

Commit ce410ce

Browse files
committed
Simplify JbuilderTemplate#array!
1 parent 1feda7e commit ce410ce

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/jbuilder/jbuilder_template.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ def cache_if!(condition, *args)
6868
condition ? cache!(*args, &::Proc.new) : yield
6969
end
7070

71-
def array!(collection = [], *attributes)
72-
options = attributes.extract_options!
71+
def array!(collection = [], *args)
72+
options = args.first
7373

74-
if options.key?(:partial)
75-
partial! options[:partial], options.merge(collection: collection)
74+
if args.one? && _partial_options?(options)
75+
partial! options.merge(collection: collection)
7676
else
7777
super
7878
end
@@ -81,7 +81,7 @@ def array!(collection = [], *attributes)
8181
def set!(name, object = BLANK, *args)
8282
options = args.first
8383

84-
return super unless _partial_options?(options)
84+
return super unless args.one? && _partial_options?(options)
8585

8686
value = if object.nil?
8787
[]

0 commit comments

Comments
 (0)