J
Joe Blow
I saw the following in a book.
def deleted_roles=(values)
roles.find(*values).each(&:destroy)
end
I understand that this method finds all the roles with the given ids and
calls destroy on all of them. My question is, what is the significance
of *. Why is it roles.find(*values) and not just plain
roles.find(values)?
Is there any difference?
Could it possibly be a typo and the method should be defined as
def deleted_roles(*values)...
Thanks
def deleted_roles=(values)
roles.find(*values).each(&:destroy)
end
I understand that this method finds all the roles with the given ids and
calls destroy on all of them. My question is, what is the significance
of *. Why is it roles.find(*values) and not just plain
roles.find(values)?
Is there any difference?
Could it possibly be a typo and the method should be defined as
def deleted_roles(*values)...
Thanks