Just a personnal point of view, but something like

    raise ArgumentError, "Must pass a non-nil hash as an argument when assigning attributes." if new_attributes.nil?

is better looking to me than the if / elsif branch