Skip to content

Commit

Permalink
Update helper.rb to fix typo (#483)
Browse files Browse the repository at this point in the history
Fix typo, update method argument for accuracy
  • Loading branch information
scottbarrow authored Mar 20, 2024
1 parent e2f88c1 commit cb672d9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/awesome_nested_set/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Helper
# You can pass a block receiving an item and returning the string displayed in the select.
#
# == Params
# * +class_or_item+ - Class name or top level times
# * +class_or_items+ - Class name or top level items
# * +mover+ - The item that is being move, used to exclude impossible moves
# * +&block+ - a block that will be used to display: { |item| ... item.name }
#
Expand All @@ -21,12 +21,12 @@ module Helper
# "#{'–' * i.level} #{i.name}"
# }) %>
#
def nested_set_options(class_or_item, mover = nil)
if class_or_item.is_a? Array
items = class_or_item.reject { |e| !e.root? }
def nested_set_options(class_or_items, mover = nil)
if class_or_items.is_a? Array
items = class_or_items.reject { |e| !e.root? }
else
class_or_item = class_or_item.roots if class_or_item.respond_to?(:scope)
items = Array(class_or_item)
class_or_items = class_or_items.roots if class_or_items.respond_to?(:scope)
items = Array(class_or_items)
end
result = []
items.each do |root|
Expand Down

0 comments on commit cb672d9

Please sign in to comment.